clicking on two raw notebook output search results in sequence throws error (#184209)

Fixes #184187
This commit is contained in:
Andrea Mah 2023-06-02 13:22:20 -07:00 committed by GitHub
parent be433ac136
commit fde89caaad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 9 deletions

View file

@ -114,7 +114,7 @@ export class FindMatchDecorationModel extends Disposable {
const deltaDecorations: ICellModelDeltaDecorations[] = cellFindMatches.map(cellFindMatch => {
// Find matches
const newFindMatchesDecorations: IModelDeltaDecoration[] = new Array<IModelDeltaDecoration>(cellFindMatch.length);
const newFindMatchesDecorations: IModelDeltaDecoration[] = new Array<IModelDeltaDecoration>(cellFindMatch.contentMatches.length);
for (let i = 0; i < cellFindMatch.contentMatches.length; i++) {
newFindMatchesDecorations[i] = {
range: cellFindMatch.contentMatches[i].range,

View file

@ -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();
}

View file

@ -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]);
}
}
}
}