From dbced5c1a442b60113083ca8c7099a7f9990f2b4 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sun, 26 Apr 2020 06:38:10 -0700 Subject: [PATCH] Move Terminal.is into InputHandler --- src/InputHandler.ts | 20 ++++++++++++++------ src/Terminal.ts | 8 -------- src/Types.d.ts | 2 -- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/InputHandler.ts b/src/InputHandler.ts index de6433143..f4a084e2c 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -1528,9 +1528,9 @@ export class InputHandler extends Disposable implements IInputHandler { if (params.params[0] > 0) { return; } - if (this._terminal.is('xterm') || this._terminal.is('rxvt-unicode') || this._terminal.is('screen')) { + if (this._is('xterm') || this._is('rxvt-unicode') || this._is('screen')) { this._coreService.triggerDataEvent(C0.ESC + '[?1;2c'); - } else if (this._terminal.is('linux')) { + } else if (this._is('linux')) { this._coreService.triggerDataEvent(C0.ESC + '[?6c'); } } @@ -1566,19 +1566,27 @@ export class InputHandler extends Disposable implements IInputHandler { // xterm and urxvt // seem to spit this // out around ~370 times (?). - if (this._terminal.is('xterm')) { + if (this._is('xterm')) { this._coreService.triggerDataEvent(C0.ESC + '[>0;276;0c'); - } else if (this._terminal.is('rxvt-unicode')) { + } else if (this._is('rxvt-unicode')) { this._coreService.triggerDataEvent(C0.ESC + '[>85;95;0c'); - } else if (this._terminal.is('linux')) { + } else if (this._is('linux')) { // not supported by linux console. // linux console echoes parameters. this._coreService.triggerDataEvent(params.params[0] + 'c'); - } else if (this._terminal.is('screen')) { + } else if (this._is('screen')) { this._coreService.triggerDataEvent(C0.ESC + '[>83;40003;0c'); } } + /** + * Evaluate if the current terminal is the given argument. + * @param term The terminal name to evaluate + */ + private _is(term: string): boolean { + return (this._optionsService.options.termName + '').indexOf(term) === 0; + } + /** * CSI Pm h Set Mode (SM). * Ps = 2 -> Keyboard Action Mode (AM). diff --git a/src/Terminal.ts b/src/Terminal.ts index 6e192320a..9dab96516 100644 --- a/src/Terminal.ts +++ b/src/Terminal.ts @@ -1316,14 +1316,6 @@ export class Terminal extends CoreTerminal implements ITerminal, IInputHandlingT this._onScroll.fire(this.buffer.ydisp); } - /** - * Evaluate if the current terminal is the given argument. - * @param term The terminal name to evaluate - */ - public is(term: string): boolean { - return (this.options.termName + '').indexOf(term) === 0; - } - /** * Emit the data event and populate the given data. * @param data The data to populate in the event. diff --git a/src/Types.d.ts b/src/Types.d.ts index c3e1c53dd..7861fc7f2 100644 --- a/src/Types.d.ts +++ b/src/Types.d.ts @@ -22,8 +22,6 @@ export type LineData = CharData[]; */ export interface IInputHandlingTerminal { viewport: IViewport; - - is(term: string): boolean; } export interface ICompositionHelper {