Can't do regex search after opening notebook (#183884)

Fixes #183858
This commit is contained in:
Andrea Mah 2023-05-30 16:09:59 -07:00 committed by GitHub
parent d1ae1fff18
commit 3370908fd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 15 deletions

View file

@ -67,20 +67,8 @@ export class SearchFindInput extends ContextScopedFindInput {
!this.filters.codeInput ||
!this.filters.codeOutput;
// for now, allow the default state to enable regex, since it would be strange for regex to suddenly
// be disabled when a notebook is opened. However, since regex isn't supported for outputs, this should
// be revisted.
if (this.regex) {
if ((this.filters.markupPreview || this.filters.codeOutput) && this._filterChecked && this._visible) {
this.regex.disable();
this.regex.domNode.tabIndex = -1;
this.regex.domNode.classList.toggle('disabled', true);
} else {
this.regex.enable();
this.regex.domNode.tabIndex = 0;
this.regex.domNode.classList.toggle('disabled', false);
}
}
// TODO: find a way to express that searching notebook output and markdown preview don't support regex.
this._findFilter.applyStyles(this._filterChecked);
}
}

View file

@ -792,7 +792,11 @@ export class FileMatch extends Disposable implements IFileMatch {
webviewMatches: webviewMatches
};
});
this._findMatchDecorationModel.setAllFindMatchesDecorations(cellFindMatch);
try {
this._findMatchDecorationModel.setAllFindMatchesDecorations(cellFindMatch);
} catch (e) {
// no op, might happen due to bugs related to cell output regex search
}
}
async updateMatchesForEditorWidget(): Promise<void> {
if (!this._notebookEditorWidget) {