diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.ts b/src/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.ts index fe5d013a6a2..4c9351bac05 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.ts @@ -114,7 +114,7 @@ export class FindMatchDecorationModel extends Disposable { const deltaDecorations: ICellModelDeltaDecorations[] = cellFindMatches.map(cellFindMatch => { // Find matches - const newFindMatchesDecorations: IModelDeltaDecoration[] = new Array(cellFindMatch.length); + const newFindMatchesDecorations: IModelDeltaDecoration[] = new Array(cellFindMatch.contentMatches.length); for (let i = 0; i < cellFindMatch.contentMatches.length; i++) { newFindMatchesDecorations[i] = { range: cellFindMatch.contentMatches[i].range, diff --git a/src/vs/workbench/contrib/search/browser/searchModel.ts b/src/vs/workbench/contrib/search/browser/searchModel.ts index c16cc0b9602..717d870a444 100644 --- a/src/vs/workbench/contrib/search/browser/searchModel.ts +++ b/src/vs/workbench/contrib/search/browser/searchModel.ts @@ -735,8 +735,6 @@ export class FileMatch extends Disposable implements IFileMatch { if (this._notebookEditorWidget) { this._notebookUpdateScheduler.cancel(); - this._findMatchDecorationModel?.dispose(); - this._findMatchDecorationModel = undefined; this._editorWidgetListener?.dispose(); } diff --git a/src/vs/workbench/contrib/search/browser/searchView.ts b/src/vs/workbench/contrib/search/browser/searchView.ts index b3aec586648..414dbfa8578 100644 --- a/src/vs/workbench/contrib/search/browser/searchView.ts +++ b/src/vs/workbench/contrib/search/browser/searchView.ts @@ -1877,16 +1877,15 @@ export class SearchView extends ViewPane { await elemParent.updateMatchesForEditorWidget(); const matchIndex = oldParentMatches.findIndex(e => e.id() === element.id()); - const matches = element.parent().matches(); + const matches = elemParent.matches(); const match = matchIndex >= matches.length ? matches[matches.length - 1] : matches[matchIndex]; if (match instanceof MatchInNotebook) { elemParent.showMatch(match); - } - - if (!this.tree.getFocus().includes(match) || !this.tree.getSelection().includes(match)) { - this.tree.setSelection([match], getSelectionKeyboardEvent()); - this.tree.setFocus([match]); + if (!this.tree.getFocus().includes(match) || !this.tree.getSelection().includes(match)) { + this.tree.setSelection([match], getSelectionKeyboardEvent()); + this.tree.setFocus([match]); + } } } }