mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-25 09:06:21 +01:00
Persist replace input text - fix #63886
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user