diff --git a/addons/xterm-addon-ligatures/src/index.ts b/addons/xterm-addon-ligatures/src/index.ts index c54f3b5048..058d9454d8 100644 --- a/addons/xterm-addon-ligatures/src/index.ts +++ b/addons/xterm-addon-ligatures/src/index.ts @@ -54,7 +54,7 @@ export function enableLigatures(term: Terminal): void { // Only refresh things if we actually found a font if (f) { - term.refresh(0, term.options.rows! - 1); + term.refresh(0, term.rows - 1); } } }) diff --git a/test/api/TestUtils.ts b/test/api/TestUtils.ts index 5731009b79..3fd0648eb4 100644 --- a/test/api/TestUtils.ts +++ b/test/api/TestUtils.ts @@ -5,7 +5,7 @@ import * as playwright from 'playwright'; import deepEqual = require('deep-equal'); -import { ITerminalOptions } from 'xterm'; +import { ITerminalInitOnlyOptions, ITerminalOptions } from 'xterm'; import { deepStrictEqual, fail } from 'assert'; export async function pollFor(page: playwright.Page, evalOrFn: string | (() => Promise), val: T, preFn?: () => Promise, maxDuration?: number): Promise { @@ -43,7 +43,7 @@ export async function timeout(ms: number): Promise { return new Promise(r => setTimeout(r, ms)); } -export async function openTerminal(page: playwright.Page, options: ITerminalOptions = {}): Promise { +export async function openTerminal(page: playwright.Page, options: ITerminalOptions & ITerminalInitOnlyOptions = {}): Promise { await page.evaluate(`window.term = new Terminal(${JSON.stringify({ allowProposedApi: true, ...options })})`); await page.evaluate(`window.term.open(document.querySelector('#terminal-container'))`); await page.waitForSelector('.xterm-rows'); diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index 8c4e7735f6..6619d4e6d9 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -21,7 +21,7 @@ declare module 'xterm' { 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 { /** @@ -55,11 +55,6 @@ declare module 'xterm' { */ convertEol?: boolean; - /** - * The number of columns in the terminal. - */ - cols?: number; - /** * Whether the cursor blinks. */ @@ -177,11 +172,6 @@ declare module 'xterm' { */ 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 @@ -248,6 +238,22 @@ declare module 'xterm' { overviewRulerWidth?: number; } + /** + * 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. */ @@ -714,7 +720,7 @@ declare module 'xterm' { * * @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.