Merge pull request #190466 from tisilent/fix-terminalFinad-initial-search

Find with selected values when reveal TerminalFind
This commit is contained in:
Daniel Imms
2023-08-16 08:16:44 -07:00
committed by GitHub
@@ -80,17 +80,18 @@ export class TerminalFindWidget extends SimpleFindWidget {
override reveal(): void {
const initialInput = this._instance.hasSelection() && !this._instance.selection!.includes('\n') ? this._instance.selection : undefined;
const inputValue = initialInput ?? this.inputValue;
const xterm = this._instance.xterm;
if (xterm && this.inputValue && this.inputValue !== '') {
if (xterm && inputValue && inputValue !== '') {
// trigger highlight all matches
this._findPreviousWithEvent(xterm, this.inputValue, { incremental: true, regex: this._getRegexValue(), wholeWord: this._getWholeWordValue(), caseSensitive: this._getCaseSensitiveValue() }).then(foundMatch => {
this._findPreviousWithEvent(xterm, inputValue, { incremental: true, regex: this._getRegexValue(), wholeWord: this._getWholeWordValue(), caseSensitive: this._getCaseSensitiveValue() }).then(foundMatch => {
this.updateButtons(foundMatch);
this._register(Event.once(xterm.onDidChangeSelection)(() => xterm.clearActiveSearchDecoration()));
});
}
this.updateButtons(false);
super.reveal(initialInput);
super.reveal(inputValue);
this._findWidgetVisible.set(true);
}