https://bugzilla.wikimedia.org/show_bug.cgi?id=39840

       Web browser: ---
             Bug #: 39840
           Summary: Search & Replace does not work in Opera
           Product: MediaWiki extensions
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: WikiEditor
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified
   Mobile Platform: ---


(I think this is also reported in bugs 22358 and 22816, but these aren't
maintained anymore and are really crowded)

The "find" routine of "Search&Replace" does not work as expected in Opera and
therefore "replace" doesn't work either.

The problem are line breaks: When getting the text from the textarea, all \r
are removed, so every line break is only one character (\n). When setting the
text selection (selectionStart/selectionEnd) Opera counts the line breaks as
two characters (\r\n).

Example:
A\r\n
B

If you want to select "B", the text of the textarea is loaded, but then the \r
is removed: "A\nB", so selectionStart=2 and selectionEnd=3. If applied to the
above text, the following result is shown (selection in []):

A\r[\n]
B

The \n is selected instead of the B.

The problem is inside "jquery,mediawiki". The function "val" on line 2143 is
used to get the content of the textarea. I don't know why, but on line 2159 not
"ret" is returned, but "ret.replace(rreturn, "")", which removes the \r.

I really don't know why this is done. Firefox+Chrome don't contain any \r in
textareas, so removing the replacement should work in Opera - but of course I
don't know which functions also rely on this "val" function.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to