Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unexpected jump to last search result when using documentsearch #7835

Merged
merged 2 commits into from Jan 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 0 additions & 12 deletions packages/documentsearch/src/providers/notebooksearchprovider.ts
Expand Up @@ -60,15 +60,10 @@ export class NotebookSearchProvider implements ISearchProvider<NotebookPanel> {
this._searchTarget = searchTarget;
const cells = this._searchTarget.content.widgets;

this._query = query;
this._filters =
!filters || Object.entries(filters).length === 0
? { output: true }
: filters;
// Listen for cell model change to redo the search in case of
// new/pasted/deleted cells
const cellList = this._searchTarget.model!.cells;
cellList.changed.connect(this._restartQuery.bind(this), this);

// hide the current notebook widget to prevent expensive layout re-calculation operations
this._searchTarget.hide();
Expand Down Expand Up @@ -461,12 +456,6 @@ export class NotebookSearchProvider implements ISearchProvider<NotebookPanel> {
return match;
}

private async _restartQuery() {
await this.endQuery();
await this.startQuery(this._query, this._searchTarget!, this._filters);
this._changed.emit(undefined);
}

private _getMatchesFromCells(): ISearchMatch[][] {
let indexTotal = 0;
const result: ISearchMatch[][] = [];
Expand Down Expand Up @@ -503,7 +492,6 @@ export class NotebookSearchProvider implements ISearchProvider<NotebookPanel> {
}

private _searchTarget: NotebookPanel | undefined | null;
private _query: RegExp;
private _filters: INotebookFilters;
private _searchProviders: ICellSearchPair[] = [];
private _currentProvider: ICellSearchPair | null | undefined;
Expand Down