check if undefined instead of index directly to fix search addon issue (#3767)

This commit is contained in:
Megan Rogge
2022-05-09 15:55:33 -07:00
committed by GitHub
parent 0c4ee0db65
commit 56c7c5c4ed
+2 -2
View File
@@ -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);