提交 4b1fcff7 编写于 作者: W wim_spaargaren@live.nl

proposal to fix issue 21600

上级 84e56fc5
......@@ -108,9 +108,12 @@ export class SearchWidget extends Widget {
private _onReplaceAll = this._register(new Emitter<void>());
public onReplaceAll: Event<void> = this._onReplaceAll.event;
private hasBeenCleared: boolean;
constructor(container: Builder, private contextViewService: IContextViewService, options: ISearchWidgetOptions = Object.create(null),
private keyBindingService: IContextKeyService, private keyBindingService2: IKeybindingService, private instantiationService: IInstantiationService) {
super();
this.setHasBeenCleared(false);
this.searchHistory = new HistoryNavigator<string>();
this.replaceActive = Constants.ReplaceActiveKey.bindTo(this.keyBindingService);
this.searchInputBoxFocussed = Constants.SearchInputBoxFocussedKey.bindTo(this.keyBindingService);
......@@ -137,12 +140,17 @@ export class SearchWidget extends Widget {
}
}
public setHasBeenCleared(cleared : boolean): void {
this.hasBeenCleared = cleared;
}
public setWidth(width: number) {
this.searchInput.setWidth(width - 2);
this.replaceInput.width = width - 28;
}
public clear() {
this.setHasBeenCleared(true);
this.searchInput.clear();
this.replaceInput.value = '';
this.setReplaceAllActionState(false);
......@@ -170,7 +178,14 @@ export class SearchWidget extends Widget {
}
public showPreviousSearchTerm() {
let previous = this.searchHistory.previous();
let previous;
if(this.hasBeenCleared){
this.setHasBeenCleared(false);
previous = this.searchHistory.current();
}else{
previous = this.searchHistory.previous();
}
if (previous) {
this.searchInput.setValue(previous);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册