提交 b1d9b098 编写于 作者: R Rob Lourens

Persist replace input text - fix #63886

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