User "Wikinaut" posted a comment on MediaWiki.r94702.

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/94702#c22094
Commit summary:

Fix a regression in search highlighting from r90092

Followup on r94609, r94681 test cases.
This fixes the test case with a period that was failing; problem was not the 
period, but the space before.
The changed regex in r90092 ended up including the preceding whitespace in the 
match, so the position of the match was coming up one character before the 
actual word -- thus offsetting the highlight by one char.

Changed from search to match, using the regex's index property (same as search 
returns) and adding in the length of the first match component which covers the 
space/whatever

Comment:

I wanted to say that Brion's fix

+ var match = node.data.match( new RegExp( "(^|\\s)" + $.escapeRE( pat ), "i" ) 
);
+                       if ( match ) {
+                               var pos = match.index + match[1].length; // 
include length of any matched spaces

is fine and should be backported to 1.17wmf1. I was not sure how exactly to 
communicate this to you.

In my view it should be patched into this 
http://svn.wikimedia.org/viewvc/mediawiki/branches/REL1_17/phase3/resources/jquery/jquery.highlightText.js?revision=79129&view=markup
 revision.


_______________________________________________
MediaWiki-CodeReview mailing list
mediawiki-coderev...@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to