From d3d8ec3b2018c51f6cbd3ee8b5225d8449d044db Mon Sep 17 00:00:00 2001 From: Ken Aoki Date: Tue, 13 Oct 2020 09:55:10 +0000 Subject: [PATCH] Fix search not expanding selection to left when appropriate (revenge) --- addons/xterm-addon-search/src/SearchAddon.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/xterm-addon-search/src/SearchAddon.ts b/addons/xterm-addon-search/src/SearchAddon.ts index f5505689..54a4a198 100644 --- a/addons/xterm-addon-search/src/SearchAddon.ts +++ b/addons/xterm-addon-search/src/SearchAddon.ts @@ -158,8 +158,13 @@ export class SearchAddon implements ITerminalAddon { }; if (incremental) { - result = this._findInLine(term, searchPosition, searchOptions, false); + result = this._findInLine(term, searchPosition, searchOptions, false); // Try to expand selection to right first. if (!(result && result.row === startRow && result.col === startCol)) { + // If selection was not able to be expanded to right, then reverse search begin. + if (currentSelection) { + searchPosition.startRow = currentSelection.endRow; + searchPosition.startCol = currentSelection.endColumn; + } result = this._findInLine(term, searchPosition, searchOptions, true); } } else {