Skip to content

Commit fde89ca

Browse files
authored
clicking on two raw notebook output search results in sequence throws error (microsoft#184209)
Fixes microsoft#184187
1 parent be433ac commit fde89ca

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

src/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export class FindMatchDecorationModel extends Disposable {
114114

115115
const deltaDecorations: ICellModelDeltaDecorations[] = cellFindMatches.map(cellFindMatch => {
116116
// Find matches
117-
const newFindMatchesDecorations: IModelDeltaDecoration[] = new Array<IModelDeltaDecoration>(cellFindMatch.length);
117+
const newFindMatchesDecorations: IModelDeltaDecoration[] = new Array<IModelDeltaDecoration>(cellFindMatch.contentMatches.length);
118118
for (let i = 0; i < cellFindMatch.contentMatches.length; i++) {
119119
newFindMatchesDecorations[i] = {
120120
range: cellFindMatch.contentMatches[i].range,

src/vs/workbench/contrib/search/browser/searchModel.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,6 @@ export class FileMatch extends Disposable implements IFileMatch {
735735

736736
if (this._notebookEditorWidget) {
737737
this._notebookUpdateScheduler.cancel();
738-
this._findMatchDecorationModel?.dispose();
739-
this._findMatchDecorationModel = undefined;
740738
this._editorWidgetListener?.dispose();
741739
}
742740

src/vs/workbench/contrib/search/browser/searchView.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,16 +1877,15 @@ export class SearchView extends ViewPane {
18771877
await elemParent.updateMatchesForEditorWidget();
18781878

18791879
const matchIndex = oldParentMatches.findIndex(e => e.id() === element.id());
1880-
const matches = element.parent().matches();
1880+
const matches = elemParent.matches();
18811881
const match = matchIndex >= matches.length ? matches[matches.length - 1] : matches[matchIndex];
18821882

18831883
if (match instanceof MatchInNotebook) {
18841884
elemParent.showMatch(match);
1885-
}
1886-
1887-
if (!this.tree.getFocus().includes(match) || !this.tree.getSelection().includes(match)) {
1888-
this.tree.setSelection([match], getSelectionKeyboardEvent());
1889-
this.tree.setFocus([match]);
1885+
if (!this.tree.getFocus().includes(match) || !this.tree.getSelection().includes(match)) {
1886+
this.tree.setSelection([match], getSelectionKeyboardEvent());
1887+
this.tree.setFocus([match]);
1888+
}
18901889
}
18911890
}
18921891
}

0 commit comments

Comments
 (0)