diff --git a/addons/addon-search/src/SearchState.ts b/addons/addon-search/src/SearchState.ts index c5e2c8881..e968fccf3 100644 --- a/addons/addon-search/src/SearchState.ts +++ b/addons/addon-search/src/SearchState.ts @@ -3,7 +3,7 @@ * @license MIT */ -import type { ISearchOptions } from '@xterm/addon-search'; +import type { ISearchDecorationOptions, ISearchOptions } from '@xterm/addon-search'; /** * Manages search state including cached search terms, options tracking, and validation. @@ -71,9 +71,27 @@ export class SearchState { if (this._lastSearchOptions.wholeWord !== newOptions.wholeWord) { return true; } + if (this._didDecorationOptionsChange(this._lastSearchOptions.decorations, newOptions.decorations)) { + return true; + } return false; } + private _didDecorationOptionsChange(previous?: ISearchDecorationOptions, current?: ISearchDecorationOptions): boolean { + if (!previous && !current) { + return false; + } + if (!previous || !current) { + return true; + } + return previous.matchBackground !== current.matchBackground || + previous.matchBorder !== current.matchBorder || + previous.matchOverviewRuler !== current.matchOverviewRuler || + previous.activeMatchBackground !== current.activeMatchBackground || + previous.activeMatchBorder !== current.activeMatchBorder || + previous.activeMatchColorOverviewRuler !== current.activeMatchColorOverviewRuler; + } + /** * Determines if a new search should trigger highlighting updates. * @param term The search term.