Notebook Find widget doesn't remove decorations on empty query (#187749)

* Notebook Find widget doesn't remove decorations on empty query
Fixes #187748

* send empty strings to find
This commit is contained in:
Andrea Mah
2023-07-14 09:51:43 -07:00
committed by GitHub
parent 5653420433
commit 80b3fcc08d
2 changed files with 9 additions and 7 deletions
@@ -471,6 +471,9 @@ export class FindModel extends Disposable {
}
private async _compute(token: CancellationToken): Promise<CellFindMatchWithIndex[] | null> {
if (!this._notebookEditor.hasModel()) {
return null;
}
let ret: CellFindMatchWithIndex[] | null = null;
const val = this._state.searchString;
const wordSeparators = this._configurationService.inspect<string>('editor.wordSeparators').value;
@@ -485,13 +488,8 @@ export class FindModel extends Disposable {
includeMarkupPreview: !!this._state.filters?.markupPreview,
includeOutput: !!this._state.filters?.codeOutput
};
if (!val) {
ret = null;
} else if (!this._notebookEditor.hasModel()) {
ret = null;
} else {
ret = await this._notebookEditor.find(val, options, token);
}
ret = await this._notebookEditor.find(val, options, token);
if (token.isCancellationRequested) {
return null;
@@ -1610,6 +1610,10 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Themable {
async find(query: string, options: { wholeWord?: boolean; caseSensitive?: boolean; includeMarkup: boolean; includeOutput: boolean; shouldGetSearchPreviewInfo: boolean; ownerID: string }): Promise<IFindMatch[]> {
if (query === '') {
this._sendMessageToWebview({
type: 'findStop',
ownerID: options.ownerID
});
return [];
}