From f276150ce4f9e9cd913f9ebbc91967de54aec61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Tue, 2 Jul 2019 20:41:21 +0200 Subject: [PATCH] remove IParams from public API --- src/public/Terminal.ts | 7 ++++--- typings/xterm.d.ts | 23 ++++------------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/public/Terminal.ts b/src/public/Terminal.ts index 03c7d36a..f06d003a 100644 --- a/src/public/Terminal.ts +++ b/src/public/Terminal.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { Terminal as ITerminalApi, ITerminalOptions, IMarker, IDisposable, ILinkMatcherOptions, ITheme, ILocalizableStrings, ITerminalAddon, ISelectionPosition, IBuffer as IBufferApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi, IParams } from 'xterm'; +import { Terminal as ITerminalApi, ITerminalOptions, IMarker, IDisposable, ILinkMatcherOptions, ITheme, ILocalizableStrings, ITerminalAddon, ISelectionPosition, IBuffer as IBufferApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi } from 'xterm'; import { ITerminal } from '../Types'; import { IBufferLine } from 'common/Types'; import { IBuffer } from 'common/buffer/Types'; @@ -11,6 +11,7 @@ import { Terminal as TerminalCore } from '../Terminal'; import * as Strings from '../browser/LocalizableStrings'; import { IEvent } from 'common/EventEmitter'; import { AddonManager } from './AddonManager'; +import { IParams } from 'common/parser/Types'; export class Terminal implements ITerminalApi { private _core: ITerminal; @@ -56,8 +57,8 @@ export class Terminal implements ITerminalApi { public attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void { this._core.attachCustomKeyEventHandler(customKeyEventHandler); } - public addCsiHandler(flag: string, callback: (params: IParams, collect: string) => boolean): IDisposable { - return this._core.addCsiHandler(flag, callback); + public addCsiHandler(flag: string, callback: (params: (number | number[])[], collect: string) => boolean): IDisposable { + return this._core.addCsiHandler(flag, (params: IParams, collect: string) => callback(params.toArray(), collect)); } public addOscHandler(ident: number, callback: (data: string) => boolean): IDisposable { return this._core.addOscHandler(ident, callback); diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index 5ec16ca7..1f308132 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -494,12 +494,14 @@ declare module 'xterm' { * final character (e.g "m" for SGR) of the CSI sequence. * @param callback The function to handle the escape sequence. The callback * is called with the numerical params, as well as the special characters - * (e.g. "$" for DECSCPP). Return true if the sequence was handled; false if + * (e.g. "$" for DECSCPP). If the sequence has subparams the array will + * contain subarrays with the their numercial values. + * Return true if the sequence was handled; false if * we should try a previous handler (set by addCsiHandler or setCsiHandler). * The most recently-added handler is tried first. * @return An IDisposable you can call to remove this handler. */ - addCsiHandler(flag: string, callback: (params: IParams, collect: string) => boolean): IDisposable; + addCsiHandler(flag: string, callback: (params: (number | number[])[], collect: string) => boolean): IDisposable; /** * (EXPERIMENTAL) Adds a handler for OSC escape sequences. @@ -931,21 +933,4 @@ declare module 'xterm' { */ readonly width: number; } - - interface IParams { - /** from ctor */ - readonly maxLength: number; - readonly maxSubParamsLength: number; - - /** param values and its length */ - readonly params: Int32Array; - readonly length: number; - - /** exported methods */ - clone(): IParams; - toArray(): (number | number[])[]; - hasSubParams(idx: number): boolean; - getSubParams(idx: number): Int32Array | null; - getSubParamsAll(): {[idx: number]: Int32Array}; - } }