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

Introduced a better solution for the problem

上级 cc495baa
......@@ -108,12 +108,9 @@ 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);
......@@ -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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册