fix(addon-search): rehighlight when search options change

Evaluate shouldUpdateHighlighting before updating lastSearchOptions so
option-only changes trigger highlight refresh for the same term.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Daniel Imms
2026-05-25 17:36:06 -07:00
co-authored by Cursor
parent 255859606c
commit bf055dd5fc
+2 -4
View File
@@ -105,8 +105,6 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
this._onBeforeSearch.fire();
this._state.lastSearchOptions = searchOptions;
if (this._state.shouldUpdateHighlighting(term, searchOptions)) {
this._highlightAllMatches(term, searchOptions!);
}
@@ -114,6 +112,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
const found = this._findNextAndSelect(term, searchOptions, internalSearchOptions);
this._fireResults(searchOptions);
this._state.cachedSearchTerm = term;
this._state.lastSearchOptions = searchOptions;
this._onAfterSearch.fire();
@@ -184,8 +183,6 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
this._onBeforeSearch.fire();
this._state.lastSearchOptions = searchOptions;
if (this._state.shouldUpdateHighlighting(term, searchOptions)) {
this._highlightAllMatches(term, searchOptions!);
}
@@ -193,6 +190,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
const found = this._findPreviousAndSelect(term, searchOptions, internalSearchOptions);
this._fireResults(searchOptions);
this._state.cachedSearchTerm = term;
this._state.lastSearchOptions = searchOptions;
this._onAfterSearch.fire();