mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Add more CSI codes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { IInputHandler, ITerminal } from './Interfaces';
|
||||
import { C0 } from './EscapeSequences';
|
||||
import { CHARSETS } from './Charsets';
|
||||
|
||||
export class InputHandler implements IInputHandler {
|
||||
// TODO: We want to type _terminal when it's pulled into TS
|
||||
@@ -511,6 +512,268 @@ export class InputHandler implements IInputHandler {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Pm d Vertical Position Absolute (VPA)
|
||||
* [row] (default = [1,column])
|
||||
*/
|
||||
public linePosAbsolute(params: number[]): void {
|
||||
let param = params[0];
|
||||
if (param < 1) {
|
||||
param = 1;
|
||||
}
|
||||
this._terminal.y = param - 1;
|
||||
if (this._terminal.y >= this._terminal.rows) {
|
||||
this._terminal.y = this._terminal.rows - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Pm e Vertical Position Relative (VPR)
|
||||
* [rows] (default = [row+1,column])
|
||||
* reuse CSI Ps B ?
|
||||
*/
|
||||
public VPositionRelative(params: number[]): void {
|
||||
let param = params[0];
|
||||
if (param < 1) {
|
||||
param = 1;
|
||||
}
|
||||
this._terminal.y += param;
|
||||
if (this._terminal.y >= this._terminal.rows) {
|
||||
this._terminal.y = this._terminal.rows - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Ps ; Ps f
|
||||
* Horizontal and Vertical Position [row;column] (default =
|
||||
* [1,1]) (HVP).
|
||||
*/
|
||||
public HVPosition(params: number[]): void {
|
||||
if (params[0] < 1) params[0] = 1;
|
||||
if (params[1] < 1) params[1] = 1;
|
||||
|
||||
this._terminal.y = params[0] - 1;
|
||||
if (this._terminal.y >= this._terminal.rows) {
|
||||
this._terminal.y = this._terminal.rows - 1;
|
||||
}
|
||||
|
||||
this._terminal.x = params[1] - 1;
|
||||
if (this._terminal.x >= this._terminal.cols) {
|
||||
this._terminal.x = this._terminal.cols - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* CSI Pm h Set Mode (SM).
|
||||
* Ps = 2 -> Keyboard Action Mode (AM).
|
||||
* Ps = 4 -> Insert Mode (IRM).
|
||||
* Ps = 1 2 -> Send/receive (SRM).
|
||||
* Ps = 2 0 -> Automatic Newline (LNM).
|
||||
* CSI ? Pm h
|
||||
* DEC Private Mode Set (DECSET).
|
||||
* Ps = 1 -> Application Cursor Keys (DECCKM).
|
||||
* Ps = 2 -> Designate USASCII for character sets G0-G3
|
||||
* (DECANM), and set VT100 mode.
|
||||
* Ps = 3 -> 132 Column Mode (DECCOLM).
|
||||
* Ps = 4 -> Smooth (Slow) Scroll (DECSCLM).
|
||||
* Ps = 5 -> Reverse Video (DECSCNM).
|
||||
* Ps = 6 -> Origin Mode (DECOM).
|
||||
* Ps = 7 -> Wraparound Mode (DECAWM).
|
||||
* Ps = 8 -> Auto-repeat Keys (DECARM).
|
||||
* Ps = 9 -> Send Mouse X & Y on button press. See the sec-
|
||||
* tion Mouse Tracking.
|
||||
* Ps = 1 0 -> Show toolbar (rxvt).
|
||||
* Ps = 1 2 -> Start Blinking Cursor (att610).
|
||||
* Ps = 1 8 -> Print form feed (DECPFF).
|
||||
* Ps = 1 9 -> Set print extent to full screen (DECPEX).
|
||||
* Ps = 2 5 -> Show Cursor (DECTCEM).
|
||||
* Ps = 3 0 -> Show scrollbar (rxvt).
|
||||
* Ps = 3 5 -> Enable font-shifting functions (rxvt).
|
||||
* Ps = 3 8 -> Enter Tektronix Mode (DECTEK).
|
||||
* Ps = 4 0 -> Allow 80 -> 132 Mode.
|
||||
* Ps = 4 1 -> more(1) fix (see curses resource).
|
||||
* Ps = 4 2 -> Enable Nation Replacement Character sets (DECN-
|
||||
* RCM).
|
||||
* Ps = 4 4 -> Turn On Margin Bell.
|
||||
* Ps = 4 5 -> Reverse-wraparound Mode.
|
||||
* Ps = 4 6 -> Start Logging. This is normally disabled by a
|
||||
* compile-time option.
|
||||
* Ps = 4 7 -> Use Alternate Screen Buffer. (This may be dis-
|
||||
* abled by the titeInhibit resource).
|
||||
* Ps = 6 6 -> Application keypad (DECNKM).
|
||||
* Ps = 6 7 -> Backarrow key sends backspace (DECBKM).
|
||||
* Ps = 1 0 0 0 -> Send Mouse X & Y on button press and
|
||||
* release. See the section Mouse Tracking.
|
||||
* Ps = 1 0 0 1 -> Use Hilite Mouse Tracking.
|
||||
* Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking.
|
||||
* Ps = 1 0 0 3 -> Use All Motion Mouse Tracking.
|
||||
* Ps = 1 0 0 4 -> Send FocusIn/FocusOut events.
|
||||
* Ps = 1 0 0 5 -> Enable Extended Mouse Mode.
|
||||
* Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt).
|
||||
* Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt).
|
||||
* Ps = 1 0 3 4 -> Interpret "meta" key, sets eighth bit.
|
||||
* (enables the eightBitInput resource).
|
||||
* Ps = 1 0 3 5 -> Enable special modifiers for Alt and Num-
|
||||
* Lock keys. (This enables the numLock resource).
|
||||
* Ps = 1 0 3 6 -> Send ESC when Meta modifies a key. (This
|
||||
* enables the metaSendsEscape resource).
|
||||
* Ps = 1 0 3 7 -> Send DEL from the editing-keypad Delete
|
||||
* key.
|
||||
* Ps = 1 0 3 9 -> Send ESC when Alt modifies a key. (This
|
||||
* enables the altSendsEscape resource).
|
||||
* Ps = 1 0 4 0 -> Keep selection even if not highlighted.
|
||||
* (This enables the keepSelection resource).
|
||||
* Ps = 1 0 4 1 -> Use the CLIPBOARD selection. (This enables
|
||||
* the selectToClipboard resource).
|
||||
* Ps = 1 0 4 2 -> Enable Urgency window manager hint when
|
||||
* Control-G is received. (This enables the bellIsUrgent
|
||||
* resource).
|
||||
* Ps = 1 0 4 3 -> Enable raising of the window when Control-G
|
||||
* is received. (enables the popOnBell resource).
|
||||
* Ps = 1 0 4 7 -> Use Alternate Screen Buffer. (This may be
|
||||
* disabled by the titeInhibit resource).
|
||||
* Ps = 1 0 4 8 -> Save cursor as in DECSC. (This may be dis-
|
||||
* abled by the titeInhibit resource).
|
||||
* Ps = 1 0 4 9 -> Save cursor as in DECSC and use Alternate
|
||||
* Screen Buffer, clearing it first. (This may be disabled by
|
||||
* the titeInhibit resource). This combines the effects of the 1
|
||||
* 0 4 7 and 1 0 4 8 modes. Use this with terminfo-based
|
||||
* applications rather than the 4 7 mode.
|
||||
* Ps = 1 0 5 0 -> Set terminfo/termcap function-key mode.
|
||||
* Ps = 1 0 5 1 -> Set Sun function-key mode.
|
||||
* Ps = 1 0 5 2 -> Set HP function-key mode.
|
||||
* Ps = 1 0 5 3 -> Set SCO function-key mode.
|
||||
* Ps = 1 0 6 0 -> Set legacy keyboard emulation (X11R6).
|
||||
* Ps = 1 0 6 1 -> Set VT220 keyboard emulation.
|
||||
* Ps = 2 0 0 4 -> Set bracketed paste mode.
|
||||
* Modes:
|
||||
* http: *vt100.net/docs/vt220-rm/chapter4.html
|
||||
*/
|
||||
public setMode(params: number[]): void {
|
||||
if (params.length > 1) {
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
this._terminal.setMode(params[i]);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this._terminal.prefix) {
|
||||
switch (params[0]) {
|
||||
case 4:
|
||||
this._terminal.insertMode = true;
|
||||
break;
|
||||
case 20:
|
||||
// this._terminal.convertEol = true;
|
||||
break;
|
||||
}
|
||||
} else if (this._terminal.prefix === '?') {
|
||||
switch (params[0]) {
|
||||
case 1:
|
||||
this._terminal.applicationCursor = true;
|
||||
break;
|
||||
case 2:
|
||||
this._terminal.setgCharset(0, CHARSETS.US);
|
||||
this._terminal.setgCharset(1, CHARSETS.US);
|
||||
this._terminal.setgCharset(2, CHARSETS.US);
|
||||
this._terminal.setgCharset(3, CHARSETS.US);
|
||||
// set VT100 mode here
|
||||
break;
|
||||
case 3: // 132 col mode
|
||||
this._terminal.savedCols = this._terminal.cols;
|
||||
this._terminal.resize(132, this._terminal.rows);
|
||||
break;
|
||||
case 6:
|
||||
this._terminal.originMode = true;
|
||||
break;
|
||||
case 7:
|
||||
this._terminal.wraparoundMode = true;
|
||||
break;
|
||||
case 12:
|
||||
// this.cursorBlink = true;
|
||||
break;
|
||||
case 66:
|
||||
this._terminal.log('Serial port requested application keypad.');
|
||||
this._terminal.applicationKeypad = true;
|
||||
this._terminal.viewport.syncScrollArea();
|
||||
break;
|
||||
case 9: // X10 Mouse
|
||||
// no release, no motion, no wheel, no modifiers.
|
||||
case 1000: // vt200 mouse
|
||||
// no motion.
|
||||
// no modifiers, except control on the wheel.
|
||||
case 1002: // button event mouse
|
||||
case 1003: // any event mouse
|
||||
// any event - sends motion events,
|
||||
// even if there is no button held down.
|
||||
|
||||
// TODO: Why are params[0] compares nested within a switch for params[0]?
|
||||
|
||||
this._terminal.x10Mouse = params[0] === 9;
|
||||
this._terminal.vt200Mouse = params[0] === 1000;
|
||||
this._terminal.normalMouse = params[0] > 1000;
|
||||
this._terminal.mouseEvents = true;
|
||||
this._terminal.element.style.cursor = 'default';
|
||||
this._terminal.log('Binding to mouse events.');
|
||||
break;
|
||||
case 1004: // send focusin/focusout events
|
||||
// focusin: ^[[I
|
||||
// focusout: ^[[O
|
||||
this._terminal.sendFocus = true;
|
||||
break;
|
||||
case 1005: // utf8 ext mode mouse
|
||||
this._terminal.utfMouse = true;
|
||||
// for wide terminals
|
||||
// simply encodes large values as utf8 characters
|
||||
break;
|
||||
case 1006: // sgr ext mode mouse
|
||||
this._terminal.sgrMouse = true;
|
||||
// for wide terminals
|
||||
// does not add 32 to fields
|
||||
// press: ^[[<b;x;yM
|
||||
// release: ^[[<b;x;ym
|
||||
break;
|
||||
case 1015: // urxvt ext mode mouse
|
||||
this._terminal.urxvtMouse = true;
|
||||
// for wide terminals
|
||||
// numbers for fields
|
||||
// press: ^[[b;x;yM
|
||||
// motion: ^[[b;x;yT
|
||||
break;
|
||||
case 25: // show cursor
|
||||
this._terminal.cursorHidden = false;
|
||||
break;
|
||||
case 1049: // alt screen buffer cursor
|
||||
// this._terminal.saveCursor();
|
||||
; // FALL-THROUGH
|
||||
case 47: // alt screen buffer
|
||||
case 1047: // alt screen buffer
|
||||
if (!this._terminal.normal) {
|
||||
let normal = {
|
||||
lines: this._terminal.lines,
|
||||
ybase: this._terminal.ybase,
|
||||
ydisp: this._terminal.ydisp,
|
||||
x: this._terminal.x,
|
||||
y: this._terminal.y,
|
||||
scrollTop: this._terminal.scrollTop,
|
||||
scrollBottom: this._terminal.scrollBottom,
|
||||
tabs: this._terminal.tabs
|
||||
// XXX save charset(s) here?
|
||||
// charset: this._terminal.charset,
|
||||
// glevel: this._terminal.glevel,
|
||||
// charsets: this._terminal.charsets
|
||||
};
|
||||
this._terminal.reset();
|
||||
this._terminal.viewport.syncScrollArea();
|
||||
this._terminal.normal = normal;
|
||||
this._terminal.showCursor();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Pm m Character Attributes (SGR).
|
||||
* Ps = 0 -> Normal (default).
|
||||
|
||||
@@ -62,6 +62,10 @@ export interface IInputHandler {
|
||||
/** CSI ` */ charPosAbsolute(params: number[]): void;
|
||||
/** CSI a */ HPositionRelative(params: number[]): void;
|
||||
/** CSI c */ sendDeviceAttributes(params: number[]): void;
|
||||
/** CSI d */ linePosAbsolute(params: number[]): void;
|
||||
/** CSI e */ VPositionRelative(params: number[]): void;
|
||||
/** CSI f */ HVPosition(params: number[]): void;
|
||||
/** CSI h */ setMode(params: number[]): void;
|
||||
/** CSI m */ charAttributes(params: number[]): void;
|
||||
/** CSI n */ deviceStatus(params: number[]): void;
|
||||
}
|
||||
|
||||
+4
-24
@@ -53,6 +53,10 @@ csiStateHandler['X'] = (handler, params) => handler.eraseChars(params);
|
||||
csiStateHandler['`'] = (handler, params) => handler.charPosAbsolute(params);
|
||||
csiStateHandler['a'] = (handler, params) => handler.HPositionRelative(params);
|
||||
csiStateHandler['c'] = (handler, params) => handler.sendDeviceAttributes(params);
|
||||
csiStateHandler['d'] = (handler, params) => handler.linePosAbsolute(params);
|
||||
csiStateHandler['e'] = (handler, params) => handler.VPositionRelative(params);
|
||||
csiStateHandler['f'] = (handler, params) => handler.HVPosition(params);
|
||||
csiStateHandler['h'] = (handler, params) => handler.setMode(params);
|
||||
csiStateHandler['m'] = (handler, params) => handler.charAttributes(params);
|
||||
csiStateHandler['n'] = (handler, params) => handler.deviceStatus(params);
|
||||
|
||||
@@ -550,30 +554,6 @@ export class Parser {
|
||||
|
||||
switch (ch) {
|
||||
|
||||
// CSI Pm d
|
||||
// Line Position Absolute [row] (default = [1,column]) (VPA).
|
||||
case 'd':
|
||||
this._terminal.linePosAbsolute(this._terminal.params);
|
||||
break;
|
||||
|
||||
// 145 65 e * VPR - Vertical Position Relative
|
||||
case 'e':
|
||||
this._terminal.VPositionRelative(this._terminal.params);
|
||||
break;
|
||||
|
||||
// CSI Ps ; Ps f
|
||||
// Horizontal and Vertical Position [row;column] (default =
|
||||
// [1,1]) (HVP).
|
||||
case 'f':
|
||||
this._terminal.HVPosition(this._terminal.params);
|
||||
break;
|
||||
|
||||
// CSI Pm h Set Mode (SM).
|
||||
// CSI ? Pm h - mouse escape codes, cursor escape codes
|
||||
case 'h':
|
||||
this._terminal.setMode(this._terminal.params);
|
||||
break;
|
||||
|
||||
// CSI Pm l Reset Mode (RM).
|
||||
// CSI ? Pm l
|
||||
case 'l':
|
||||
|
||||
-259
@@ -2326,265 +2326,6 @@ Terminal.prototype.tabSet = function() {
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* CSI Pm d
|
||||
* Line Position Absolute [row] (default = [1,column]) (VPA).
|
||||
*/
|
||||
Terminal.prototype.linePosAbsolute = function(params) {
|
||||
var param = params[0];
|
||||
if (param < 1) param = 1;
|
||||
this.y = param - 1;
|
||||
if (this.y >= this.rows) {
|
||||
this.y = this.rows - 1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 145 65 e * VPR - Vertical Position Relative
|
||||
* reuse CSI Ps B ?
|
||||
*/
|
||||
Terminal.prototype.VPositionRelative = function(params) {
|
||||
var param = params[0];
|
||||
if (param < 1) param = 1;
|
||||
this.y += param;
|
||||
if (this.y >= this.rows) {
|
||||
this.y = this.rows - 1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* CSI Ps ; Ps f
|
||||
* Horizontal and Vertical Position [row;column] (default =
|
||||
* [1,1]) (HVP).
|
||||
*/
|
||||
Terminal.prototype.HVPosition = function(params) {
|
||||
if (params[0] < 1) params[0] = 1;
|
||||
if (params[1] < 1) params[1] = 1;
|
||||
|
||||
this.y = params[0] - 1;
|
||||
if (this.y >= this.rows) {
|
||||
this.y = this.rows - 1;
|
||||
}
|
||||
|
||||
this.x = params[1] - 1;
|
||||
if (this.x >= this.cols) {
|
||||
this.x = this.cols - 1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* CSI Pm h Set Mode (SM).
|
||||
* Ps = 2 -> Keyboard Action Mode (AM).
|
||||
* Ps = 4 -> Insert Mode (IRM).
|
||||
* Ps = 1 2 -> Send/receive (SRM).
|
||||
* Ps = 2 0 -> Automatic Newline (LNM).
|
||||
* CSI ? Pm h
|
||||
* DEC Private Mode Set (DECSET).
|
||||
* Ps = 1 -> Application Cursor Keys (DECCKM).
|
||||
* Ps = 2 -> Designate USASCII for character sets G0-G3
|
||||
* (DECANM), and set VT100 mode.
|
||||
* Ps = 3 -> 132 Column Mode (DECCOLM).
|
||||
* Ps = 4 -> Smooth (Slow) Scroll (DECSCLM).
|
||||
* Ps = 5 -> Reverse Video (DECSCNM).
|
||||
* Ps = 6 -> Origin Mode (DECOM).
|
||||
* Ps = 7 -> Wraparound Mode (DECAWM).
|
||||
* Ps = 8 -> Auto-repeat Keys (DECARM).
|
||||
* Ps = 9 -> Send Mouse X & Y on button press. See the sec-
|
||||
* tion Mouse Tracking.
|
||||
* Ps = 1 0 -> Show toolbar (rxvt).
|
||||
* Ps = 1 2 -> Start Blinking Cursor (att610).
|
||||
* Ps = 1 8 -> Print form feed (DECPFF).
|
||||
* Ps = 1 9 -> Set print extent to full screen (DECPEX).
|
||||
* Ps = 2 5 -> Show Cursor (DECTCEM).
|
||||
* Ps = 3 0 -> Show scrollbar (rxvt).
|
||||
* Ps = 3 5 -> Enable font-shifting functions (rxvt).
|
||||
* Ps = 3 8 -> Enter Tektronix Mode (DECTEK).
|
||||
* Ps = 4 0 -> Allow 80 -> 132 Mode.
|
||||
* Ps = 4 1 -> more(1) fix (see curses resource).
|
||||
* Ps = 4 2 -> Enable Nation Replacement Character sets (DECN-
|
||||
* RCM).
|
||||
* Ps = 4 4 -> Turn On Margin Bell.
|
||||
* Ps = 4 5 -> Reverse-wraparound Mode.
|
||||
* Ps = 4 6 -> Start Logging. This is normally disabled by a
|
||||
* compile-time option.
|
||||
* Ps = 4 7 -> Use Alternate Screen Buffer. (This may be dis-
|
||||
* abled by the titeInhibit resource).
|
||||
* Ps = 6 6 -> Application keypad (DECNKM).
|
||||
* Ps = 6 7 -> Backarrow key sends backspace (DECBKM).
|
||||
* Ps = 1 0 0 0 -> Send Mouse X & Y on button press and
|
||||
* release. See the section Mouse Tracking.
|
||||
* Ps = 1 0 0 1 -> Use Hilite Mouse Tracking.
|
||||
* Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking.
|
||||
* Ps = 1 0 0 3 -> Use All Motion Mouse Tracking.
|
||||
* Ps = 1 0 0 4 -> Send FocusIn/FocusOut events.
|
||||
* Ps = 1 0 0 5 -> Enable Extended Mouse Mode.
|
||||
* Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt).
|
||||
* Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt).
|
||||
* Ps = 1 0 3 4 -> Interpret "meta" key, sets eighth bit.
|
||||
* (enables the eightBitInput resource).
|
||||
* Ps = 1 0 3 5 -> Enable special modifiers for Alt and Num-
|
||||
* Lock keys. (This enables the numLock resource).
|
||||
* Ps = 1 0 3 6 -> Send ESC when Meta modifies a key. (This
|
||||
* enables the metaSendsEscape resource).
|
||||
* Ps = 1 0 3 7 -> Send DEL from the editing-keypad Delete
|
||||
* key.
|
||||
* Ps = 1 0 3 9 -> Send ESC when Alt modifies a key. (This
|
||||
* enables the altSendsEscape resource).
|
||||
* Ps = 1 0 4 0 -> Keep selection even if not highlighted.
|
||||
* (This enables the keepSelection resource).
|
||||
* Ps = 1 0 4 1 -> Use the CLIPBOARD selection. (This enables
|
||||
* the selectToClipboard resource).
|
||||
* Ps = 1 0 4 2 -> Enable Urgency window manager hint when
|
||||
* Control-G is received. (This enables the bellIsUrgent
|
||||
* resource).
|
||||
* Ps = 1 0 4 3 -> Enable raising of the window when Control-G
|
||||
* is received. (enables the popOnBell resource).
|
||||
* Ps = 1 0 4 7 -> Use Alternate Screen Buffer. (This may be
|
||||
* disabled by the titeInhibit resource).
|
||||
* Ps = 1 0 4 8 -> Save cursor as in DECSC. (This may be dis-
|
||||
* abled by the titeInhibit resource).
|
||||
* Ps = 1 0 4 9 -> Save cursor as in DECSC and use Alternate
|
||||
* Screen Buffer, clearing it first. (This may be disabled by
|
||||
* the titeInhibit resource). This combines the effects of the 1
|
||||
* 0 4 7 and 1 0 4 8 modes. Use this with terminfo-based
|
||||
* applications rather than the 4 7 mode.
|
||||
* Ps = 1 0 5 0 -> Set terminfo/termcap function-key mode.
|
||||
* Ps = 1 0 5 1 -> Set Sun function-key mode.
|
||||
* Ps = 1 0 5 2 -> Set HP function-key mode.
|
||||
* Ps = 1 0 5 3 -> Set SCO function-key mode.
|
||||
* Ps = 1 0 6 0 -> Set legacy keyboard emulation (X11R6).
|
||||
* Ps = 1 0 6 1 -> Set VT220 keyboard emulation.
|
||||
* Ps = 2 0 0 4 -> Set bracketed paste mode.
|
||||
* Modes:
|
||||
* http: *vt100.net/docs/vt220-rm/chapter4.html
|
||||
*/
|
||||
Terminal.prototype.setMode = function(params) {
|
||||
if (typeof params === 'object') {
|
||||
var l = params.length
|
||||
, i = 0;
|
||||
|
||||
for (; i < l; i++) {
|
||||
this.setMode(params[i]);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.prefix) {
|
||||
switch (params) {
|
||||
case 4:
|
||||
this.insertMode = true;
|
||||
break;
|
||||
case 20:
|
||||
//this.convertEol = true;
|
||||
break;
|
||||
}
|
||||
} else if (this.prefix === '?') {
|
||||
switch (params) {
|
||||
case 1:
|
||||
this.applicationCursor = true;
|
||||
break;
|
||||
case 2:
|
||||
this.setgCharset(0, CHARSETS.US);
|
||||
this.setgCharset(1, CHARSETS.US);
|
||||
this.setgCharset(2, CHARSETS.US);
|
||||
this.setgCharset(3, CHARSETS.US);
|
||||
// set VT100 mode here
|
||||
break;
|
||||
case 3: // 132 col mode
|
||||
this.savedCols = this.cols;
|
||||
this.resize(132, this.rows);
|
||||
break;
|
||||
case 6:
|
||||
this.originMode = true;
|
||||
break;
|
||||
case 7:
|
||||
this.wraparoundMode = true;
|
||||
break;
|
||||
case 12:
|
||||
// this.cursorBlink = true;
|
||||
break;
|
||||
case 66:
|
||||
this.log('Serial port requested application keypad.');
|
||||
this.applicationKeypad = true;
|
||||
this.viewport.syncScrollArea();
|
||||
break;
|
||||
case 9: // X10 Mouse
|
||||
// no release, no motion, no wheel, no modifiers.
|
||||
case 1000: // vt200 mouse
|
||||
// no motion.
|
||||
// no modifiers, except control on the wheel.
|
||||
case 1002: // button event mouse
|
||||
case 1003: // any event mouse
|
||||
// any event - sends motion events,
|
||||
// even if there is no button held down.
|
||||
this.x10Mouse = params === 9;
|
||||
this.vt200Mouse = params === 1000;
|
||||
this.normalMouse = params > 1000;
|
||||
this.mouseEvents = true;
|
||||
this.element.style.cursor = 'default';
|
||||
this.log('Binding to mouse events.');
|
||||
break;
|
||||
case 1004: // send focusin/focusout events
|
||||
// focusin: ^[[I
|
||||
// focusout: ^[[O
|
||||
this.sendFocus = true;
|
||||
break;
|
||||
case 1005: // utf8 ext mode mouse
|
||||
this.utfMouse = true;
|
||||
// for wide terminals
|
||||
// simply encodes large values as utf8 characters
|
||||
break;
|
||||
case 1006: // sgr ext mode mouse
|
||||
this.sgrMouse = true;
|
||||
// for wide terminals
|
||||
// does not add 32 to fields
|
||||
// press: ^[[<b;x;yM
|
||||
// release: ^[[<b;x;ym
|
||||
break;
|
||||
case 1015: // urxvt ext mode mouse
|
||||
this.urxvtMouse = true;
|
||||
// for wide terminals
|
||||
// numbers for fields
|
||||
// press: ^[[b;x;yM
|
||||
// motion: ^[[b;x;yT
|
||||
break;
|
||||
case 25: // show cursor
|
||||
this.cursorHidden = false;
|
||||
break;
|
||||
case 1049: // alt screen buffer cursor
|
||||
//this.saveCursor();
|
||||
; // FALL-THROUGH
|
||||
case 47: // alt screen buffer
|
||||
case 1047: // alt screen buffer
|
||||
if (!this.normal) {
|
||||
var normal = {
|
||||
lines: this.lines,
|
||||
ybase: this.ybase,
|
||||
ydisp: this.ydisp,
|
||||
x: this.x,
|
||||
y: this.y,
|
||||
scrollTop: this.scrollTop,
|
||||
scrollBottom: this.scrollBottom,
|
||||
tabs: this.tabs
|
||||
// XXX save charset(s) here?
|
||||
// charset: this.charset,
|
||||
// glevel: this.glevel,
|
||||
// charsets: this.charsets
|
||||
};
|
||||
this.reset();
|
||||
this.viewport.syncScrollArea();
|
||||
this.normal = normal;
|
||||
this.showCursor();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* CSI Pm l Reset Mode (RM).
|
||||
* Ps = 2 -> Keyboard Action Mode (AM).
|
||||
|
||||
Reference in New Issue
Block a user