From 56c7c5c4eda4ef55005b0370d49087b69c8bb2c6 Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Mon, 9 May 2022 15:55:33 -0700 Subject: [PATCH] check if undefined instead of index directly to fix search addon issue (#3767) --- addons/xterm-addon-search/src/SearchAddon.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/xterm-addon-search/src/SearchAddon.ts b/addons/xterm-addon-search/src/SearchAddon.ts index a56b3ab3..c92c6c8a 100644 --- a/addons/xterm-addon-search/src/SearchAddon.ts +++ b/addons/xterm-addon-search/src/SearchAddon.ts @@ -128,7 +128,7 @@ export class SearchAddon implements ITerminalAddon { } this._lastSearchOptions = searchOptions; if (searchOptions?.decorations) { - if (this._resultIndex || this._cachedSearchTerm && term !== this._cachedSearchTerm) { + if (this._resultIndex !== undefined || this._cachedSearchTerm && term !== this._cachedSearchTerm) { this._highlightAllMatches(term, searchOptions); } } @@ -306,7 +306,7 @@ export class SearchAddon implements ITerminalAddon { throw new Error('Cannot use addon until it has been loaded'); } this._lastSearchOptions = searchOptions; - if (searchOptions?.decorations && (this._resultIndex || term !== this._cachedSearchTerm)) { + if (searchOptions?.decorations && (this._resultIndex !== undefined || term !== this._cachedSearchTerm)) { this._highlightAllMatches(term, searchOptions); } return this._fireResults(term, this._findPreviousAndSelect(term, searchOptions), searchOptions);