https://bugzilla.wikimedia.org/show_bug.cgi?id=30130
--- Comment #25 from Brion Vibber <br...@wikimedia.org> 2011-09-08 18:26:39 UTC --- Background on the selection bug: Unicode text may include sequences composed of a base character followed by one or more combining characters: [lowercase latin letter "a"] [combining acute accent] [combining underdot] These are distinct, separately addressable characters, but will render together as a unit. This is extremely common for Indic scripts, which apply multiple vowel-indicating & other diacritics onto a consonant base character. In Webkit, if we set a textarea's selection start or end point in the middle of a combining sequence, the selection point is silently moved to the boundary of the sequence. We can either select the entire sequence, or none of it. Thus if we thought we had selected the [combining acute accent] and [combining underdot] we may find that our selection is actually empty, as the start point is moved down to the end of the sequence. When we go to replace the text using jquery.textSelection's insertion goodie, it substrings out the pieces using the new, modified selection -- which means we've trimmed out a different substring than the one we had specified coordinates for, and inserted a new substring that doesn't fit properly. One way to work around this is to check the new caret position, so we can adjust our replacement string to fit the actual insertion point. Another is to do the string replacement directly and not use the selection at all... except on IE, it looks like jquery.textSelection's replacement actually works by taking the entire textarea contents as a string, substringing some pieces, and replacing the entire string anyway -- so it's only going awry because the selection position gets moved from what we asked for. (There is surprisingly no standard DOM-ish way to say "replace the selected text with this value, without changing the other megabyte of text in this textarea"!) -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l