@@ -723,10 +723,7 @@ export class FileMatch extends Disposable implements IFileMatch {
723
723
}
724
724
this . _notebookUpdateScheduler . schedule ( ) ;
725
725
} ) ?? null ;
726
-
727
- this . _findMatchDecorationModel ?. stopWebviewFind ( ) ;
728
- this . _findMatchDecorationModel ?. dispose ( ) ;
729
- this . _findMatchDecorationModel = new FindMatchDecorationModel ( this . _notebookEditorWidget ) ;
726
+ this . _addNotebookHighlights ( ) ;
730
727
}
731
728
732
729
unbindNotebookEditorWidget ( widget ?: NotebookEditorWidget ) {
@@ -738,13 +735,34 @@ export class FileMatch extends Disposable implements IFileMatch {
738
735
this . _notebookUpdateScheduler . cancel ( ) ;
739
736
this . _editorWidgetListener ?. dispose ( ) ;
740
737
}
738
+ this . _removeNotebookHighlights ( ) ;
739
+ this . _notebookEditorWidget = null ;
740
+ }
741
+
742
+ updateNotebookHighlights ( ) : void {
743
+ if ( this . parent ( ) . showHighlights ) {
744
+ this . _addNotebookHighlights ( ) ;
745
+ this . setNotebookFindMatchDecorationsUsingCellMatches ( Array . from ( this . _cellMatches . values ( ) ) ) ;
746
+ } else {
747
+ this . _removeNotebookHighlights ( ) ;
748
+ }
749
+ }
741
750
751
+ private _addNotebookHighlights ( ) : void {
752
+ if ( ! this . _notebookEditorWidget ) {
753
+ return ;
754
+ }
755
+ this . _findMatchDecorationModel ?. stopWebviewFind ( ) ;
756
+ this . _findMatchDecorationModel ?. dispose ( ) ;
757
+ this . _findMatchDecorationModel = new FindMatchDecorationModel ( this . _notebookEditorWidget ) ;
758
+ }
759
+
760
+ private _removeNotebookHighlights ( ) : void {
742
761
if ( this . _findMatchDecorationModel ) {
743
762
this . _findMatchDecorationModel ?. stopWebviewFind ( ) ;
744
763
this . _findMatchDecorationModel ?. dispose ( ) ;
745
764
this . _findMatchDecorationModel = undefined ;
746
765
}
747
- this . _notebookEditorWidget = null ;
748
766
}
749
767
private updateNotebookMatches ( matches : CellFindMatchWithIndex [ ] , modelChange : boolean ) : void {
750
768
@@ -1808,6 +1826,7 @@ export class SearchResult extends Disposable {
1808
1826
let selectedMatch : Match | null = null ;
1809
1827
this . matches ( ) . forEach ( ( fileMatch : FileMatch ) => {
1810
1828
fileMatch . updateHighlights ( ) ;
1829
+ fileMatch . updateNotebookHighlights ( ) ;
1811
1830
if ( ! selectedMatch ) {
1812
1831
selectedMatch = fileMatch . getSelectedMatch ( ) ;
1813
1832
}
0 commit comments