提交 a45a4de4 编写于 作者: S Sandeep Somavarapu

fix #8330

上级 f8fee759
......@@ -315,6 +315,10 @@ export class SearchViewlet extends Viewlet {
}
private replaceAll(): void {
if (this.viewModel.count() === 0) {
return;
}
let progressRunner= this.progressService.show(100);
let occurrences= this.viewModel.count();
......@@ -325,7 +329,7 @@ export class SearchViewlet extends Viewlet {
let confirmation= {
title: nls.localize('replaceAll.confirmation.title', "Replace All"),
message: replaceValue ? nls.localize('replaceAll.confirmation.message', "Replace {0} occurrences with '{1}' across {2} files?", occurrences, replaceValue, fileCount)
message: replaceValue ? nls.localize('replaceAll.confirmation.message', "Replace {0} occurrences across {1} files with '{2}'?", occurrences, fileCount, replaceValue)
: nls.localize('removeAll.confirmation.message', "Remove {0} occurrences across {1} files?", occurrences, fileCount),
primaryButton: nls.localize('replaceAll.confirm.button', "Replace")
};
......@@ -811,6 +815,7 @@ export class SearchViewlet extends Viewlet {
}
doneTimer.stop();
this.searchWidget.setReplaceAllActionState(this.viewModel.count() > 0);
};
let onError = (e: any) => {
......
......@@ -34,7 +34,6 @@ export class SearchWidget extends Widget {
public domNode: HTMLElement;
public searchInput: FindInput;
private replaceInput: InputBox;
private searchSubmitted: boolean= false;
private replaceInputContainer: HTMLElement;
private toggleReplaceButton: Button;
......@@ -91,9 +90,9 @@ export class SearchWidget extends Widget {
}
public clear() {
this.searchSubmitted= false;
this.searchInput.clear();
this.replaceInput.value= '';
this.setReplaceAllActionState(false);
}
public isReplaceActive(): boolean {
......@@ -163,7 +162,6 @@ export class SearchWidget extends Widget {
this.onkeyup(this.replaceInput.inputElement, (keyboardEvent) => this.onReplaceInputKeyUp(keyboardEvent));
this.replaceInput.onDidChange(() => this._onReplaceValueChanged.fire());
this.searchInput.inputBox.onDidChange(() => this.onSearchInputChanged());
this.onSearchSubmit(() => this.updateReplaceActionState());
}
private onToggleReplaceButton():void {
......@@ -171,12 +169,7 @@ export class SearchWidget extends Widget {
dom.toggleClass(this.toggleReplaceButton.getElement(), 'collapse');
dom.toggleClass(this.toggleReplaceButton.getElement(), 'expand');
this._onReplaceToggled.fire();
this.updateReplaceActionState();
}
private updateReplaceActionState():void {
let enabled= this.isReplaceShown() && this.searchSubmitted;
this.setReplaceAllActionState(enabled);
this._onReplaceState.fire();
}
private validatSearchInput(value: string): any {
......@@ -198,8 +191,7 @@ export class SearchWidget extends Widget {
}
private onSearchInputChanged(): void {
this.searchSubmitted= false;
this.updateReplaceActionState();
this.setReplaceAllActionState(false);
}
private onSearchInputKeyUp(keyboardEvent: IKeyboardEvent) {
......@@ -259,7 +251,6 @@ export class SearchWidget extends Widget {
private submitSearch(refresh: boolean= true): void {
if (this.searchInput.getValue()) {
this.searchSubmitted= true;
this._onSearchSubmit.fire(refresh);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册