From bf055dd5fc06b05385d877e96ca14342d65f6d88 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Mon, 25 May 2026 17:36:06 -0700 Subject: [PATCH] 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 --- addons/addon-search/src/SearchAddon.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/addon-search/src/SearchAddon.ts b/addons/addon-search/src/SearchAddon.ts index cb4094743..a06b9a4fc 100644 --- a/addons/addon-search/src/SearchAddon.ts +++ b/addons/addon-search/src/SearchAddon.ts @@ -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();