From dc30a51017dccc86b313039def5e3cb926ac36f6 Mon Sep 17 00:00:00 2001 From: Simon Lamon Date: Sat, 30 Jul 2022 15:46:07 +0000 Subject: [PATCH 1/3] Apply row/col changes from xterm to xtmer-headless --- typings/xterm-headless.d.ts | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/typings/xterm-headless.d.ts b/typings/xterm-headless.d.ts index d39a7098..04732cea 100644 --- a/typings/xterm-headless.d.ts +++ b/typings/xterm-headless.d.ts @@ -48,11 +48,6 @@ declare module 'xterm-headless' { */ convertEol?: boolean; - /** - * The number of columns in the terminal. - */ - cols?: number; - /** * Whether the cursor blinks. */ @@ -145,11 +140,6 @@ declare module 'xterm-headless' { */ rightClickSelectsWord?: boolean; - /** - * The number of rows in the terminal. - */ - rows?: number; - /** * Whether screen reader support is enabled. When on this will expose * supporting elements in the DOM to support NVDA on Windows and VoiceOver @@ -210,6 +200,22 @@ declare module 'xterm-headless' { windowOptions?: IWindowOptions; } + /** + * An object containing additional options for the terminal that can only be + * set on start up. + */ + export interface ITerminalInitOnlyOptions { + /** + * The number of columns in the terminal. + */ + cols?: number; + + /** + * The number of rows in the terminal. + */ + rows?: number; + } + /** * Contains colors to theme the terminal with. */ @@ -558,7 +564,7 @@ declare module 'xterm-headless' { * * @param options An object containing a set of options. */ - constructor(options?: ITerminalOptions); + constructor(options?: ITerminalOptions & ITerminalInitOnlyOptions); /** * Adds an event listener for when the bell is triggered. From 027fffbadc2949d866208c973d8f7c19b1894144 Mon Sep 17 00:00:00 2001 From: Simon Lamon Date: Sat, 30 Jul 2022 15:48:49 +0000 Subject: [PATCH 2/3] Fix comment --- typings/xterm-headless.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typings/xterm-headless.d.ts b/typings/xterm-headless.d.ts index 04732cea..cda7ad1a 100644 --- a/typings/xterm-headless.d.ts +++ b/typings/xterm-headless.d.ts @@ -14,7 +14,7 @@ declare module 'xterm-headless' { export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'off'; /** - * An object containing start up options for the terminal. + * An object containing options for the terminal. */ export interface ITerminalOptions { /** From 31686fda614a8c23955306857e365caec4d70a6a Mon Sep 17 00:00:00 2001 From: Simon Lamon Date: Sun, 31 Jul 2022 07:54:29 +0000 Subject: [PATCH 3/3] Fix tests --- src/headless/public/Terminal.test.ts | 7 ++----- src/headless/public/Terminal.ts | 5 ++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/headless/public/Terminal.test.ts b/src/headless/public/Terminal.test.ts index 7f341b91..43aaf628 100644 --- a/src/headless/public/Terminal.test.ts +++ b/src/headless/public/Terminal.test.ts @@ -125,13 +125,10 @@ describe('Headless API Tests', function (): void { }); it('get options', () => { const options: ITerminalOptions = term.options; - strictEqual(options.cols, 80); - strictEqual(options.rows, 24); + strictEqual(options.lineHeight, 1); + strictEqual(options.cursorWidth, 1); }); it('set options', async () => { - const options: ITerminalOptions = term.options; - throws(() => options.cols = 40); - throws(() => options.rows = 20); term.options.scrollback = 1; strictEqual(term.options.scrollback, 1); term.options= { diff --git a/src/headless/public/Terminal.ts b/src/headless/public/Terminal.ts index 451d2372..efc0a8a1 100644 --- a/src/headless/public/Terminal.ts +++ b/src/headless/public/Terminal.ts @@ -7,11 +7,10 @@ import { IEvent } from 'common/EventEmitter'; import { BufferNamespaceApi } from 'common/public/BufferNamespaceApi'; import { ParserApi } from 'common/public/ParserApi'; import { UnicodeApi } from 'common/public/UnicodeApi'; -import { IBufferNamespace as IBufferNamespaceApi, IMarker, IModes, IParser, ITerminalAddon, IUnicodeHandling, Terminal as ITerminalApi } from 'xterm-headless'; +import { IBufferNamespace as IBufferNamespaceApi, IMarker, IModes, IParser, ITerminalAddon, ITerminalInitOnlyOptions, IUnicodeHandling, Terminal as ITerminalApi } from 'xterm-headless'; import { Terminal as TerminalCore } from 'headless/Terminal'; import { AddonManager } from 'common/public/AddonManager'; import { ITerminalOptions } from 'common/Types'; - /** * The set of options that only have an effect when set in the Terminal constructor. */ @@ -24,7 +23,7 @@ export class Terminal implements ITerminalApi { private _buffer: BufferNamespaceApi | undefined; private _publicOptions: ITerminalOptions; - constructor(options?: ITerminalOptions) { + constructor(options?: ITerminalOptions & ITerminalInitOnlyOptions) { this._core = new TerminalCore(options); this._addonManager = new AddonManager();