diff --git a/src/browser/public/Terminal.ts b/src/browser/public/Terminal.ts index 7b2e7ee6..9571afa6 100644 --- a/src/browser/public/Terminal.ts +++ b/src/browser/public/Terminal.ts @@ -173,7 +173,7 @@ export class Terminal implements ITerminalApi { } public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined { this._checkProposedApi(); - this._verifyPositiveInteger(decorationOptions.x); + this._verifyPositiveIntegers(decorationOptions.x ?? 0, decorationOptions.width ?? 0, decorationOptions.height ?? 0); return this._core.registerDecoration(decorationOptions); } public addMarker(cursorYOffset: number): IMarker | undefined { @@ -287,9 +287,11 @@ export class Terminal implements ITerminalApi { } } - private _verifyPositiveInteger(value?: number): void { - if (value && (value === Infinity || isNaN(value) || value % 1 !== 0 || value < 0)) { - throw new Error('This API only accepts positive integers'); + private _verifyPositiveIntegers(...values: number[]): void { + for (const value of values) { + if (value && (value === Infinity || isNaN(value) || value % 1 !== 0 || value < 0)) { + throw new Error('This API only accepts positive integers'); + } } } } diff --git a/src/browser/services/DecorationService.ts b/src/browser/services/DecorationService.ts index bea34d9a..08e8e9c7 100644 --- a/src/browser/services/DecorationService.ts +++ b/src/browser/services/DecorationService.ts @@ -111,6 +111,9 @@ export class Decoration extends Disposable implements IDecoration { this._element.style.height = `${this.height * renderService.dimensions.scaledCellHeight}px`; this._element.style.top = `${(this.marker.line - bufferService.buffers.active.ydisp) * renderService.dimensions.scaledCellHeight}px`; + if (this.x && this.x > bufferService.cols) { + this._element!.style.display = 'none'; + } if (this.anchor === 'right') { this._element.style.right = this.x ? `${this.x * renderService.dimensions.scaledCellWidth}px` : ''; } else {