From ea72a3b594c2d67da0b3d4b1f1c485ab8cd57e39 Mon Sep 17 00:00:00 2001 From: Logan Ramos Date: Thu, 25 Jul 2019 08:50:37 -0700 Subject: [PATCH] Fix incremental search bug --- addons/xterm-addon-search/src/SearchAddon.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/xterm-addon-search/src/SearchAddon.ts b/addons/xterm-addon-search/src/SearchAddon.ts index b3b430a5..2b8c4234 100644 --- a/addons/xterm-addon-search/src/SearchAddon.ts +++ b/addons/xterm-addon-search/src/SearchAddon.ts @@ -137,8 +137,14 @@ export class SearchAddon implements ITerminalAddon { this._initLinesCache(); - // Search startRow - result = incremental ? this._findInLine(term, startRow, startCol, searchOptions, false) : this._findInLine(term, startRow, startCol, searchOptions, isReverseSearch); + if (incremental) { + result = this._findInLine(term, startRow, startCol, searchOptions, false); + if (!(result && result.row === startRow && result.col === startCol)) { + result = this._findInLine(term, startRow, startCol, searchOptions, true); + } + } else { + result = this._findInLine(term, startRow, startCol, searchOptions, isReverseSearch); + } // Search from startRow - 1 to top if (!result) {