@@ -393,10 +393,10 @@ define(function (require, exports, module) {
393393 }
394394
395395 /** Removes the current-match highlight, leaving all matches marked in the generic highlight style */
396- function clearCurrentMatchHighlight ( cm , state ) {
396+ function clearCurrentMatchHighlight ( editor , state ) {
397397 if ( state . markedCurrent ) {
398398 state . markedCurrent . clear ( ) ;
399- ScrollTrackMarkers . markCurrent ( - 1 ) ;
399+ ScrollTrackMarkers . markCurrent ( - 1 , editor ) ;
400400 }
401401 }
402402
@@ -405,7 +405,7 @@ define(function (require, exports, module) {
405405 const pos = editor . getCursorPos ( false , "start" ) ;
406406 cm . operation ( function ( ) {
407407 var state = getSearchState ( cm ) ;
408- clearCurrentMatchHighlight ( cm , state ) ;
408+ clearCurrentMatchHighlight ( editor , state ) ;
409409
410410 let curIndex = editor . indexFromPos ( pos ) ;
411411 curIndex = curIndex >= 1 ? curIndex -- : 0 ;
@@ -424,7 +424,7 @@ define(function (require, exports, module) {
424424 { from : thisMatch . start , to : thisMatch . end } , false ) ;
425425 // Update current-tickmark indicator - only if highlighting enabled (disabled if FIND_HIGHLIGHT_MAX threshold hit)
426426 if ( state . marked . length ) {
427- ScrollTrackMarkers . markCurrent ( state . matchIndex ) ; // _updateFindBarWithMatchInfo() has updated this index
427+ ScrollTrackMarkers . markCurrent ( state . matchIndex , editor ) ; // _updateFindBarWithMatchInfo() has updated this index
428428 }
429429 }
430430
@@ -454,7 +454,7 @@ define(function (require, exports, module) {
454454 var cm = editor . _codeMirror ;
455455 cm . operation ( function ( ) {
456456 var state = getSearchState ( cm ) ;
457- clearCurrentMatchHighlight ( cm , state ) ;
457+ clearCurrentMatchHighlight ( editor , state ) ;
458458
459459 var nextMatch = _getNextMatch ( editor , searchBackwards , pos ) ;
460460 if ( nextMatch ) {
@@ -464,7 +464,7 @@ define(function (require, exports, module) {
464464 { from : nextMatch . start , to : nextMatch . end } , searchBackwards ) ;
465465 // Update current-tickmark indicator - only if highlighting enabled (disabled if FIND_HIGHLIGHT_MAX threshold hit)
466466 if ( state . marked . length ) {
467- ScrollTrackMarkers . markCurrent ( state . matchIndex ) ; // _updateFindBarWithMatchInfo() has updated this index
467+ ScrollTrackMarkers . markCurrent ( state . matchIndex , editor ) ; // _updateFindBarWithMatchInfo() has updated this index
468468 }
469469 }
470470
@@ -485,31 +485,33 @@ define(function (require, exports, module) {
485485 }
486486
487487 /** Clears all match highlights, including the current match */
488- function clearHighlights ( cm , state ) {
488+ function clearHighlights ( editor , state ) {
489+ const cm = editor . _codeMirror ;
489490 cm . operation ( function ( ) {
490491 state . marked . forEach ( function ( markedRange ) {
491492 markedRange . clear ( ) ;
492493 } ) ;
493- clearCurrentMatchHighlight ( cm , state ) ;
494+ clearCurrentMatchHighlight ( editor , state ) ;
494495 } ) ;
495496 state . marked . length = 0 ;
496497 state . markedCurrent = null ;
497498
498- ScrollTrackMarkers . clear ( ) ;
499+ ScrollTrackMarkers . clear ( editor ) ;
499500
500501 state . resultSet = [ ] ;
501502 state . matchIndex = - 1 ;
502503 }
503504
504- function clearSearch ( cm ) {
505+ function clearSearch ( editor ) {
506+ const cm = editor . _codeMirror ;
505507 cm . operation ( function ( ) {
506508 var state = getSearchState ( cm ) ;
507509 if ( ! state . parsedQuery ) {
508510 return ;
509511 }
510512 setQueryInfo ( state , null ) ;
511513
512- clearHighlights ( cm , state ) ;
514+ clearHighlights ( editor , state ) ;
513515 } ) ;
514516 }
515517
@@ -544,7 +546,7 @@ define(function (require, exports, module) {
544546 cm . operation ( function ( ) {
545547 // Clear old highlights
546548 if ( state . marked ) {
547- clearHighlights ( cm , state ) ;
549+ clearHighlights ( editor , state ) ;
548550 }
549551
550552 if ( ! state . parsedQuery ) {
@@ -676,7 +678,7 @@ define(function (require, exports, module) {
676678 . on ( "close.FindReplace" , function ( e ) {
677679 editor . lastParsedQuery = state . parsedQuery ;
678680 // Clear highlights but leave search state in place so Find Next/Previous work after closing
679- clearHighlights ( cm , state ) ;
681+ clearHighlights ( editor , state ) ;
680682
681683 // Dispose highlighting UI (important to restore normal selection color as soon as focus goes back to the editor)
682684 toggleHighlighting ( editor , false ) ;
@@ -770,7 +772,7 @@ define(function (require, exports, module) {
770772
771773 if ( editor ) {
772774 // Create a new instance of the search bar UI
773- clearSearch ( editor . _codeMirror ) ;
775+ clearSearch ( editor ) ;
774776 doSearch ( editor , false ) ;
775777 }
776778 }
0 commit comments