From be49cd0e43d16e504f1cff9b735a8a923274eff5 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Thu, 12 Dec 2019 15:24:56 -0800 Subject: [PATCH] Fix #85921 --- .../workbench/contrib/search/browser/searchView.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/vs/workbench/contrib/search/browser/searchView.ts b/src/vs/workbench/contrib/search/browser/searchView.ts index 1540549709e..f05ce8c7be8 100644 --- a/src/vs/workbench/contrib/search/browser/searchView.ts +++ b/src/vs/workbench/contrib/search/browser/searchView.ts @@ -137,6 +137,7 @@ export class SearchView extends ViewPane { private delayedRefresh: Delayer; private changedWhileHidden: boolean = false; + private updatedActionsWhileHidden = false; private searchWithoutFolderMessageElement: HTMLElement | undefined; @@ -348,6 +349,13 @@ export class SearchView extends ViewPane { this.refreshAndUpdateCount(); this.changedWhileHidden = false; } + + if (this.updatedActionsWhileHidden) { + // The actions can only run or update their enablement when the view is visible, + // because they can only access the view when it's visible + this.updateActions(); + this.updatedActionsWhileHidden = false; + } } // Enable highlights if there are searchresults @@ -372,6 +380,10 @@ export class SearchView extends ViewPane { * Warning: a bit expensive due to updating the view title */ protected updateActions(): void { + if (!this.isVisible()) { + this.updatedActionsWhileHidden = true; + } + for (const action of this.actions) { action.update(); } -- GitLab