From ee322c811f6d3f921fd101486f6ced0e094700f7 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Mon, 25 May 2026 18:02:22 -0700 Subject: [PATCH] fix(addon-search): skip overview ruler when colors are omitted Support optional overview ruler colors from decoration options without passing undefined into terminal decoration registration. Co-authored-by: Cursor --- addons/addon-search/src/DecorationManager.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/addons/addon-search/src/DecorationManager.ts b/addons/addon-search/src/DecorationManager.ts index 919ae16dc..c7087aca6 100644 --- a/addons/addon-search/src/DecorationManager.ts +++ b/addons/addon-search/src/DecorationManager.ts @@ -94,6 +94,20 @@ export class DecorationManager extends Disposable { * @param borderColor The border color to apply. * @param isActiveResult Whether the element is part of the active search result. */ + private _getOverviewRulerOptions(line: number, isActiveResult: boolean, options: ISearchDecorationOptions) { + if (this._highlightedLines.has(line)) { + return undefined; + } + const color = isActiveResult ? options.activeMatchColorOverviewRuler : options.matchOverviewRuler; + if (!color) { + return undefined; + } + return { + color, + position: 'center' as const + }; + } + private _applyStyles(element: HTMLElement, borderColor: string | undefined, isActiveResult: boolean): void { if (!element.classList.contains('xterm-find-result-decoration')) { element.classList.add('xterm-find-result-decoration'); @@ -137,10 +151,7 @@ export class DecorationManager extends Disposable { width: range[2], layer: isActiveResult ? 'top' : 'bottom', backgroundColor: isActiveResult ? options.activeMatchBackground : options.matchBackground, - overviewRulerOptions: this._highlightedLines.has(marker.line) ? undefined : { - color: isActiveResult ? options.activeMatchColorOverviewRuler : options.matchOverviewRuler, - position: 'center' - } + overviewRulerOptions: this._getOverviewRulerOptions(marker.line, isActiveResult, options) }); if (decoration) { const disposables: IDisposable[] = [];