From 3f1bf5fa8deacc08f6195f4b5dda7b323f20362b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moreno?= Date: Thu, 29 Sep 2022 12:36:07 -0700 Subject: [PATCH] list find: remember last input (#162398) fixes #156248 --- src/vs/base/browser/ui/tree/abstractTree.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/vs/base/browser/ui/tree/abstractTree.ts b/src/vs/base/browser/ui/tree/abstractTree.ts index aa74182dc21..b77d5e9e5dd 100644 --- a/src/vs/base/browser/ui/tree/abstractTree.ts +++ b/src/vs/base/browser/ui/tree/abstractTree.ts @@ -695,6 +695,14 @@ class FindWidget extends Disposable { this.findInput.inputBox.setPlaceHolder(mode === TreeFindMode.Filter ? localize('type to filter', "Type to filter") : localize('type to search', "Type to search")); } + get value(): string { + return this.findInput.inputBox.value; + } + + set value(value: string) { + this.findInput.inputBox.value = value; + } + private readonly modeToggle: ModeToggle; private readonly findInput: FindInput; private readonly actionbar: ActionBar; @@ -876,6 +884,7 @@ class FindController implements IDisposable { private _pattern = ''; get pattern(): string { return this._pattern; } + private previousPattern = ''; private _mode: TreeFindMode; get mode(): TreeFindMode { return this._mode; } @@ -940,6 +949,9 @@ class FindController implements IDisposable { this.widget.layout(this.width); this.widget.focus(); + this.widget.value = this.previousPattern; + this.widget.select(); + this._onDidChangeOpenState.fire(true); } @@ -953,6 +965,7 @@ class FindController implements IDisposable { this.enabledDisposables.dispose(); this.enabledDisposables = new DisposableStore(); + this.previousPattern = this.pattern; this.onDidChangeValue(''); this.tree.domFocus();