Ticket #1828: 1828.patch
File 1828.patch, 3.7 KB (added by , 16 years ago) |
---|
-
_whatsnew.html
90 90 the type of an existing button.</li> 91 91 <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1854">#1854</a>] Indentation now works inside 92 92 table cells.</li> 93 <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1828">#1828</a>] The Find/Replace dialog 94 will no longer display wrong starting positions for the match when there are multiple and identical 95 characters preceding the character at the real starting point of the match.</li> 93 96 </ul> 94 97 <p> 95 98 <a href="_whatsnew_history.html">See previous versions history</a> -
editor/dialog/fck_replace.html
97 97 98 98 function btnStat(frm) 99 99 { 100 document.getElementById('btnReplace').disabled =101 document.getElementById('btnReplaceAll').disabled =102 document.getElementById('btnFind').disabled =103 ( document.getElementById(idMap["FindText"]).value.length == 0 ) ;100 GetE('btnReplace').disabled = 101 GetE('btnReplaceAll').disabled = 102 GetE('btnFind').disabled = 103 ( GetE(idMap["FindText"]).value.length == 0 ) ; 104 104 } 105 105 106 106 function GetSearchString() 107 107 { 108 return document.getElementById(idMap['FindText']).value ;108 return GetE(idMap['FindText']).value ; 109 109 } 110 110 111 111 function GetReplaceString() 112 112 { 113 return document.getElementById("txtReplace").value ;113 return GetE("txtReplace").value ; 114 114 } 115 115 116 116 function GetCheckCase() 117 117 { 118 return !! ( document.getElementById(idMap['CheckCase']).checked ) ;118 return !! ( GetE(idMap['CheckCase']).checked ) ; 119 119 } 120 120 121 121 function GetMatchWord() 122 122 { 123 return !! ( document.getElementById(idMap['CheckWord']).checked ) ;123 return !! ( GetE(idMap['CheckWord']).checked ) ; 124 124 } 125 125 126 126 // Get the data pointed to by a bookmark. … … 221 221 222 222 // Knuth-Morris-Pratt Algorithm for stream input 223 223 KMP_NOMATCH = 0 ; 224 KMP_ADVANCED = 1 ; 225 KMP_MATCHED = 2 ; 224 KMP_STARTED = 1 ; 225 KMP_ADVANCED = 2 ; 226 KMP_MATCHED = 3 ; 226 227 function KmpMatch( pattern, ignoreCase ) 227 228 { 228 229 var overlap = [ -1 ] ; … … 257 258 this._State = 0; 258 259 return KMP_MATCHED; 259 260 } 260 return KMP_ADVANCED;261 return this._State > 1 ? KMP_ADVANCED : KMP_STARTED ; 261 262 } 262 263 else if ( this._State == 0 ) 263 264 return KMP_NOMATCH; … … 301 302 { 302 303 matchState = matcher.FeedCharacter(data) ; 303 304 305 // No possible match of any useful substring in the pattern for the currently scanned character. 306 // So delete any positional information. 304 307 if ( matchState == KMP_NOMATCH ) 305 308 matchBookmark = null ; 306 else if ( matchState == KMP_ADVANCED && matchBookmark == null ) 309 // The currently scanned character is a possible start, so mark down the starting position. 310 else if ( matchState == KMP_STARTED ) 307 311 matchBookmark = { Start : cursor.concat( [] ) } ; 312 // Found a complete match! Mark down the ending position as well. 308 313 else if ( matchState == KMP_MATCHED ) 309 314 { 315 // It is possible to get a KMP_MATCHED without KMP_STARTED when the match pattern is only 1 character. 316 // So need to check and mark down the starting position as well. 310 317 if ( matchBookmark == null ) 311 318 matchBookmark = { Start : cursor.concat( [] ) } ; 319 312 320 matchBookmark.End = cursor.concat( [] ) ; 313 321 matchBookmark.End[ matchBookmark.End.length - 1 ]++; 314 322 315 323 // Wait, do we have to match a whole word? 324 // If yes, carry out additional checks on what we've got. 316 325 if ( GetMatchWord() ) 317 326 { 318 327 var startOk = false ;