diff --git a/src/browser/Decorations/OverviewRulerRenderer.ts b/src/browser/Decorations/OverviewRulerRenderer.ts index b34b592d..620e4dbb 100644 --- a/src/browser/Decorations/OverviewRulerRenderer.ts +++ b/src/browser/Decorations/OverviewRulerRenderer.ts @@ -92,7 +92,7 @@ export class OverviewRulerRenderer extends Disposable { return; } this._ctx.lineWidth = 1; - this._ctx.fillStyle = decoration.options.overviewRulerOptions.color; + this._ctx.fillStyle = decoration.overviewRulerOptions?.color || decoration.options.overviewRulerOptions.color; this._ctx.fillRect( !decoration.options.overviewRulerOptions.position || decoration.options.overviewRulerOptions.position === 'left' ? 0 : decoration.options.overviewRulerOptions.position === 'right' ? renderSizes[SizeIndex.OUTER_SIZE] + renderSizes[SizeIndex.INNER_SIZE]: renderSizes[SizeIndex.OUTER_SIZE], Math.round(this._canvas.height * (decoration.options.marker.line / this._bufferService.buffers.active.lines.length)), diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index 24ba940e..deaecb79 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -434,10 +434,26 @@ declare module 'xterm' { /** * The element that the decoration is rendered to. This will be undefined - * until it is rendered for the first time by @{link IDecoration.onRender}. + * until it is rendered for the first time by {@link IDecoration.onRender}. * that. */ element: HTMLElement | undefined; + + /** + * The options for the overview ruler that can be updated. + * This will only take effect when {@link IDecorationOptions.overviewRulerOptions} + * were provided initially. + */ + overviewRulerOptions?: Pick; + } + + + /** + * Overview ruler decoration options + */ + interface IDecorationOverviewRulerOptions { + color: string; + position?: 'left' | 'center' | 'right'; } /* @@ -479,7 +495,7 @@ declare module 'xterm' { * @param color The color of the decoration. * @param position The position of the decoration. */ - readonly overviewRulerOptions?: { color: string; position?: 'left' | 'center' | 'right'} + overviewRulerOptions?: IDecorationOverviewRulerOptions } /**