list find: remember last input (#162398)

fixes #156248
This commit is contained in:
João Moreno 2022-09-29 12:36:07 -07:00 committed by GitHub
parent 9e099a8d79
commit 3f1bf5fa8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -695,6 +695,14 @@ class FindWidget<T, TFilterData> 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<T, TFilterData> 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<T, TFilterData> 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<T, TFilterData> implements IDisposable {
this.enabledDisposables.dispose();
this.enabledDisposables = new DisposableStore();
this.previousPattern = this.pattern;
this.onDidChangeValue('');
this.tree.domFocus();