mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Merge pull request #3972 from silamon/rowscolsheadless
Apply row/col changes from xterm to xterm-headless
This commit is contained in:
@@ -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= {
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Vendored
+18
-12
@@ -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 {
|
||||
/**
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user