Skip to content

Commit 3f1bf5f

Browse files
authored
list find: remember last input (microsoft#162398)
fixes microsoft#156248
1 parent 9e099a8 commit 3f1bf5f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/vs/base/browser/ui/tree/abstractTree.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,14 @@ class FindWidget<T, TFilterData> extends Disposable {
695695
this.findInput.inputBox.setPlaceHolder(mode === TreeFindMode.Filter ? localize('type to filter', "Type to filter") : localize('type to search', "Type to search"));
696696
}
697697

698+
get value(): string {
699+
return this.findInput.inputBox.value;
700+
}
701+
702+
set value(value: string) {
703+
this.findInput.inputBox.value = value;
704+
}
705+
698706
private readonly modeToggle: ModeToggle;
699707
private readonly findInput: FindInput;
700708
private readonly actionbar: ActionBar;
@@ -876,6 +884,7 @@ class FindController<T, TFilterData> implements IDisposable {
876884

877885
private _pattern = '';
878886
get pattern(): string { return this._pattern; }
887+
private previousPattern = '';
879888

880889
private _mode: TreeFindMode;
881890
get mode(): TreeFindMode { return this._mode; }
@@ -940,6 +949,9 @@ class FindController<T, TFilterData> implements IDisposable {
940949
this.widget.layout(this.width);
941950
this.widget.focus();
942951

952+
this.widget.value = this.previousPattern;
953+
this.widget.select();
954+
943955
this._onDidChangeOpenState.fire(true);
944956
}
945957

@@ -953,6 +965,7 @@ class FindController<T, TFilterData> implements IDisposable {
953965
this.enabledDisposables.dispose();
954966
this.enabledDisposables = new DisposableStore();
955967

968+
this.previousPattern = this.pattern;
956969
this.onDidChangeValue('');
957970
this.tree.domFocus();
958971

0 commit comments

Comments
 (0)