Page MenuHomePhabricator

wikiEditor's replace function inserts string in wrong places
Closed, ResolvedPublic


(i was sure there was an open report already, but i couldn't find it, so here goes)


    1. open
    2. in toolbar, click "advance" and then click the "search and replace" icon
    3. "Search for" => france; "Replace with" => schmance
    4. hit "Replace"
    5. notice that editor added "schmance" before any other character in edit box
    1. without closing the s&r form, hit "Replace" couple more times. notice that it executed correct replacements
    2. now click inside the textarea somewhere (*not* just-before-the-f of the word "France")
    3. hit "Replace" in the s&r box again: notice that it adds "schmance" at the caret location
    4. rinse and repeat

so the s&r "Replace" does something-other-than-what-you-want-it-to-do when there is no caret in the edit box at all, and when the caret is anywhere except in front of the search word. it seems that the way to make it work as advertised is to hit "Find" first and then "Replace", without moving the caret. this is not the expected pattern, and not the way s&r behaves on any text editor i ever used.

if this issue is already reported (which is what i remembered), please mark as "duplicate".


Event Timeline

Kipod raised the priority of this task from to Needs Triage.
Kipod updated the task description. (Show Details)
Kipod changed Security from none to None.
Kipod subscribed.

Which browser and version is this about? Always welcome when filing WikiEditor bugs.
See also the list of issues in WikiEditor that include the word "replace".

this happens with google chrome (v39) on windows and linux, and firefox (v33) on windows and linux. it probably happens with any other geko and webkit browser.

if you have any browser for which s&r is enabled, i urge you to repeat the simple and clear reproduction steps i listed.
i do not believe you'll find a single browser that will fail to reproduce the problem.

it does no show up with IE, mainly because s&r form is disabled for IE (btw: why does the s&r icon still shows with IE? this is bizarre, i think. if the functionality is not there, showing the icon is wrong. it's only use is to frustrate the user).


Aklapper renamed this task from wikiEditor "replace" borked to wikiEditor's replace function inserts string in wrong places.Dec 8 2014, 10:41 AM
Aklapper triaged this task as Low priority.
TheDJ subscribed.

Found the cause of this. It's because there is no initial selection, because 'find' has not been used before 'replace' is used. This messes up the offsets that the panel keeps internally.

Change 474461 had a related patch set uploaded (by TheDJ; owner: TheDJ):
[mediawiki/extensions/WikiEditor@master] Search & Replace: Fix using replace as first action

Change 474461 merged by jenkins-bot:
[mediawiki/extensions/WikiEditor@master] Search & Replace: Fix using replace as first action

Jdforrester-WMF assigned this task to TheDJ.
Jdforrester-WMF removed a project: Patch-For-Review.
Jdforrester-WMF moved this task from Doing to Closed on the WikiEditor board.