in src/InputHandler.ts [1219:1329]
public setMode(params: number[], collect?: string): void {
if (params.length > 1) {
for (let i = 0; i < params.length; i++) {
this.setMode([params[i]]);
}
return;
}
if (!collect) {
switch (params[0]) {
case 4:
this._terminal.insertMode = true;
break;
case 20:
// this._t.convertEol = true;
break;
}
} else if (collect === '?') {
switch (params[0]) {
case 1:
this._terminal.applicationCursor = true;
break;
case 2:
this._terminal.setgCharset(0, DEFAULT_CHARSET);
this._terminal.setgCharset(1, DEFAULT_CHARSET);
this._terminal.setgCharset(2, DEFAULT_CHARSET);
this._terminal.setgCharset(3, DEFAULT_CHARSET);
// 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.classList.add('enable-mouse-events');
this._terminal.selectionManager.disable();
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
// TODO: Not sure if we need to save/restore after switching the buffer
// this.saveCursor(params);
// FALL-THROUGH
case 47: // alt screen buffer
case 1047: // alt screen buffer
this._terminal.buffers.activateAltBuffer();
this._terminal.viewport.syncScrollArea();
this._terminal.showCursor();
break;
case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)
this._terminal.bracketedPasteMode = true;
break;
}
}
}