diff --git a/src/vs/workbench/parts/search/browser/searchWidget.ts b/src/vs/workbench/parts/search/browser/searchWidget.ts index bb134d0d1b14dd01b972855585a91588aa61299b..6fe164daf55eefa7b68676b135c87c1f49719e63 100644 --- a/src/vs/workbench/parts/search/browser/searchWidget.ts +++ b/src/vs/workbench/parts/search/browser/searchWidget.ts @@ -108,12 +108,9 @@ export class SearchWidget extends Widget { private _onReplaceAll = this._register(new Emitter()); public onReplaceAll: Event = 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(); this.replaceActive = Constants.ReplaceActiveKey.bindTo(this.keyBindingService); this.searchInputBoxFocussed = Constants.SearchInputBoxFocussedKey.bindTo(this.keyBindingService); @@ -140,17 +137,12 @@ 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); @@ -179,8 +171,7 @@ export class SearchWidget extends Widget { public showPreviousSearchTerm() { let previous; - if (this.hasBeenCleared) { - this.setHasBeenCleared(false); + if (this.searchInput.getValue().length === 0) { previous = this.searchHistory.current(); } else { previous = this.searchHistory.previous();