Persist replace input text - fix #63886

This commit is contained in:
Rob Lourens
2018-11-27 18:02:14 -08:00
parent 9d2251469f
commit b1d9b0982e
2 changed files with 5 additions and 0 deletions
@@ -303,6 +303,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
private createSearchWidget(container: HTMLElement): void {
let contentPattern = this.viewletState['query.contentPattern'] || '';
const replaceText = this.viewletState['query.replaceText'] || '';
let isRegex = this.viewletState['query.regex'] === true;
let isWholeWords = this.viewletState['query.wholeWords'] === true;
let isCaseSensitive = this.viewletState['query.caseSensitive'] === true;
@@ -313,6 +314,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
this.searchWidget = this._register(this.instantiationService.createInstance(SearchWidget, container, <ISearchWidgetOptions>{
value: contentPattern,
replaceValue: replaceText,
isRegex: isRegex,
isCaseSensitive: isCaseSensitive,
isWholeWords: isWholeWords,
@@ -1572,6 +1574,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
const isReplaceShown = this.searchAndReplaceWidget.isReplaceShown();
this.viewletState['view.showReplace'] = isReplaceShown;
this.viewletState['query.replaceText'] = isReplaceShown && this.searchWidget.getReplaceValue();
const history: ISearchHistoryValues = Object.create(null);
@@ -37,6 +37,7 @@ import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
export interface ISearchWidgetOptions {
value?: string;
replaceValue?: string;
isRegex?: boolean;
isCaseSensitive?: boolean;
isWholeWords?: boolean;
@@ -336,6 +337,7 @@ export class SearchWidget extends Widget {
}, this.contextKeyService));
this._register(attachInputBoxStyler(this.replaceInput, this.themeService));
this.onkeydown(this.replaceInput.inputElement, (keyboardEvent) => this.onReplaceInputKeyDown(keyboardEvent));
this.replaceInput.value = options.replaceValue || '';
this.replaceInput.onDidChange(() => this._onReplaceValueChanged.fire());
this.searchInput.inputBox.onDidChange(() => this.onSearchInputChanged());