From bb2193676b483eec739eaef84c8c524841937eb4 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Thu, 17 Mar 2022 16:20:47 -0400 Subject: [PATCH 1/4] fix problems --- src/browser/Decorations/OverviewRulerRenderer.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/browser/Decorations/OverviewRulerRenderer.ts b/src/browser/Decorations/OverviewRulerRenderer.ts index d497b14b..24a5173b 100644 --- a/src/browser/Decorations/OverviewRulerRenderer.ts +++ b/src/browser/Decorations/OverviewRulerRenderer.ts @@ -87,7 +87,7 @@ export class OverviewRulerRenderer extends Disposable { return; } this._ctx.lineWidth = 1; - this._ctx.fillStyle = decoration.overviewRulerOptions?.color || decoration.options.overviewRulerOptions.color; + this._ctx.fillStyle = decoration.options.overviewRulerOptions.color; this._ctx.fillRect( decoration.options.overviewRulerOptions.position === 'full' || 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)), @@ -113,15 +113,7 @@ export class OverviewRulerRenderer extends Disposable { const element = this._decorationElements.get(decoration); if (!element) { this._decorationElements.set(decoration, this._canvas); - decoration.onDispose(() => { - this._ctx?.clearRect( - !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)), - !decoration!.options!.overviewRulerOptions?.position ? this._width : decoration!.options!.overviewRulerOptions?.position === 'center' ? renderSizes[SizeIndex.INNER_SIZE] : renderSizes[SizeIndex.OUTER_SIZE], - // when a position is provided, the element has less width, so increase its height - window.devicePixelRatio * (decoration!.options!.overviewRulerOptions?.position ? 6 : 2) - ); - }); + decoration[0].onDispose(() => (this._queueRefresh())); } this._refreshStyle(decoration, updateAnchor); } From 8f1dcecb5088bdaa8e0e5951e6d25d6d1c1ad1cf Mon Sep 17 00:00:00 2001 From: meganrogge Date: Thu, 17 Mar 2022 16:23:37 -0400 Subject: [PATCH 2/4] dispose of decoration --- src/browser/Decorations/OverviewRulerRenderer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/Decorations/OverviewRulerRenderer.ts b/src/browser/Decorations/OverviewRulerRenderer.ts index 24a5173b..1998d18a 100644 --- a/src/browser/Decorations/OverviewRulerRenderer.ts +++ b/src/browser/Decorations/OverviewRulerRenderer.ts @@ -113,7 +113,7 @@ export class OverviewRulerRenderer extends Disposable { const element = this._decorationElements.get(decoration); if (!element) { this._decorationElements.set(decoration, this._canvas); - decoration[0].onDispose(() => (this._queueRefresh())); + decoration.onDispose(() => this._queueRefresh()); } this._refreshStyle(decoration, updateAnchor); } From a05cdbd48e15987ebe105c9805c9bd3af1ddd3f3 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Thu, 17 Mar 2022 16:30:55 -0400 Subject: [PATCH 3/4] Remove accidental import --- typings/xterm.d.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index 410cef46..4f06d5f5 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -7,8 +7,6 @@ * to be stable and consumed by external programs. */ -import { IModelDecorationOverviewRulerOptions } from 'vs/editor/common/model'; - /// declare module 'xterm' { @@ -432,14 +430,14 @@ declare module 'xterm' { * is rendered, returns the dom element * associated with the decoration. */ - readonly onRender: IEvent; + readonly onRender: IEvent; /** * The element that the decoration is rendered to. This will be undefined * until it is rendered for the first time by {@link IDecoration.onRender}. * that. */ - element: HTMLElement | undefined; + element: HTMLLIElement | undefined; /** * The options for the overview ruler that can be updated. @@ -679,7 +677,7 @@ declare module 'xterm' { /** * The element containing the terminal. */ - readonly element: HTMLElement | undefined; + readonly element: HTMLLIElement | undefined; /** * The textarea that accepts input for the terminal. From 02e2727fb527265a304f87a13f9a442702270774 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Thu, 17 Mar 2022 16:36:34 -0400 Subject: [PATCH 4/4] fix typos --- typings/xterm.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index 4f06d5f5..d1eb3890 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -430,14 +430,14 @@ declare module 'xterm' { * is rendered, returns the dom element * associated with the decoration. */ - readonly onRender: IEvent; + readonly onRender: IEvent; /** * The element that the decoration is rendered to. This will be undefined * until it is rendered for the first time by {@link IDecoration.onRender}. * that. */ - element: HTMLLIElement | undefined; + element: HTMLElement | undefined; /** * The options for the overview ruler that can be updated. @@ -677,7 +677,7 @@ declare module 'xterm' { /** * The element containing the terminal. */ - readonly element: HTMLLIElement | undefined; + readonly element: HTMLElement | undefined; /** * The textarea that accepts input for the terminal.