Skip to content

Commit 32e5cb0

Browse files
committed
[F] do not enter quick nav for a failed search
1 parent 0d28e6a commit 32e5cb0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/webview/input.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export class Input {
9090
intoQuickNav() {
9191
this.enterNav();
9292
if (!this.searcher) return;
93+
if (!this.searcher.foundAny) return;
9394
this.quickNavs = this.searcher.setQuickNavKey();
9495
}
9596

@@ -392,6 +393,8 @@ class Searcher {
392393
private tree: TreeNode;
393394
private searchReg: RegExp | string | null = null;
394395

396+
foundAny = false;
397+
395398
constructor(root: HTMLDivElement, init: SearchConfig) {
396399
this.tree = new TreeNode(root);
397400
this.search(init);
@@ -418,7 +421,7 @@ class Searcher {
418421
break;
419422
}
420423
if (this.searchReg) {
421-
this.searchTree(this.tree, this.searchReg, config.filter);
424+
this.foundAny = this.searchTree(this.tree, this.searchReg, config.filter);
422425
}
423426
}
424427

0 commit comments

Comments
 (0)