Have undefined | true mean success
This commit is contained in:
@@ -353,7 +353,7 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
|
||||
if (this._oscHandlers[ident] === undefined) {
|
||||
this._oscHandlers[ident] = [];
|
||||
}
|
||||
const handlerList = this._oscHandlers[ident];
|
||||
const handlerList = this._oscHandlers[ident];
|
||||
handlerList.push(callback);
|
||||
return {
|
||||
dispose: () => {
|
||||
@@ -505,7 +505,8 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
|
||||
const handlers = this._csiHandlers[code];
|
||||
let j = handlers ? handlers.length - 1 : -1;
|
||||
for (; j >= 0; j--) {
|
||||
if (handlers[j](params, collect)) {
|
||||
// undefined or true means success and to stop bubbling
|
||||
if (handlers[j](params, collect) !== false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -590,7 +591,8 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
|
||||
const handlers = this._oscHandlers[identifier];
|
||||
let j = handlers ? handlers.length - 1 : -1;
|
||||
for (; j >= 0; j--) {
|
||||
if (handlers[j](content)) {
|
||||
// undefined or true means success and to stop bubbling
|
||||
if (handlers[j](content) !== false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+63
-116
@@ -439,16 +439,15 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* BEL
|
||||
* Bell (Ctrl-G).
|
||||
*/
|
||||
public bell(): boolean {
|
||||
public bell(): void {
|
||||
this._terminal.bell();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* LF
|
||||
* Line Feed or New Line (NL). (LF is Ctrl-J).
|
||||
*/
|
||||
public lineFeed(): boolean {
|
||||
public lineFeed(): void {
|
||||
// make buffer local for faster access
|
||||
const buffer = this._terminal.buffer;
|
||||
|
||||
@@ -470,40 +469,36 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* @event linefeed
|
||||
*/
|
||||
this._terminal.emit('linefeed');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CR
|
||||
* Carriage Return (Ctrl-M).
|
||||
*/
|
||||
public carriageReturn(): boolean {
|
||||
public carriageReturn(): void {
|
||||
this._terminal.buffer.x = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* BS
|
||||
* Backspace (Ctrl-H).
|
||||
*/
|
||||
public backspace(): boolean {
|
||||
public backspace(): void {
|
||||
if (this._terminal.buffer.x > 0) {
|
||||
this._terminal.buffer.x--;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* TAB
|
||||
* Horizontal Tab (HT) (Ctrl-I).
|
||||
*/
|
||||
public tab(): boolean {
|
||||
public tab(): void {
|
||||
const originalX = this._terminal.buffer.x;
|
||||
this._terminal.buffer.x = this._terminal.buffer.nextStop();
|
||||
if (this._terminal.options.screenReaderMode) {
|
||||
this._terminal.emit('a11y.tab', this._terminal.buffer.x - originalX);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -511,9 +506,8 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* Shift Out (Ctrl-N) -> Switch to Alternate Character Set. This invokes the
|
||||
* G1 character set.
|
||||
*/
|
||||
public shiftOut(): boolean {
|
||||
public shiftOut(): void {
|
||||
this._terminal.setgLevel(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -521,30 +515,28 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* Shift In (Ctrl-O) -> Switch to Standard Character Set. This invokes the G0
|
||||
* character set (the default).
|
||||
*/
|
||||
public shiftIn(): boolean {
|
||||
public shiftIn(): void {
|
||||
this._terminal.setgLevel(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Ps @
|
||||
* Insert Ps (Blank) Character(s) (default = 1) (ICH).
|
||||
*/
|
||||
public insertChars(params: number[]): boolean {
|
||||
public insertChars(params: number[]): void {
|
||||
this._terminal.buffer.lines.get(this._terminal.buffer.y + this._terminal.buffer.ybase).insertCells(
|
||||
this._terminal.buffer.x,
|
||||
params[0] || 1,
|
||||
this._terminal.buffer.getNullCell(this._terminal.eraseAttr())
|
||||
);
|
||||
this._terminal.updateRange(this._terminal.buffer.y);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Ps A
|
||||
* Cursor Up Ps Times (default = 1) (CUU).
|
||||
*/
|
||||
public cursorUp(params: number[]): boolean {
|
||||
public cursorUp(params: number[]): void {
|
||||
let param = params[0];
|
||||
if (param < 1) {
|
||||
param = 1;
|
||||
@@ -553,14 +545,13 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
if (this._terminal.buffer.y < 0) {
|
||||
this._terminal.buffer.y = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Ps B
|
||||
* Cursor Down Ps Times (default = 1) (CUD).
|
||||
*/
|
||||
public cursorDown(params: number[]): boolean {
|
||||
public cursorDown(params: number[]): void {
|
||||
let param = params[0];
|
||||
if (param < 1) {
|
||||
param = 1;
|
||||
@@ -573,14 +564,13 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
if (this._terminal.buffer.x >= this._terminal.cols) {
|
||||
this._terminal.buffer.x--;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Ps C
|
||||
* Cursor Forward Ps Times (default = 1) (CUF).
|
||||
*/
|
||||
public cursorForward(params: number[]): boolean {
|
||||
public cursorForward(params: number[]): void {
|
||||
let param = params[0];
|
||||
if (param < 1) {
|
||||
param = 1;
|
||||
@@ -589,14 +579,13 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
if (this._terminal.buffer.x >= this._terminal.cols) {
|
||||
this._terminal.buffer.x = this._terminal.cols - 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Ps D
|
||||
* Cursor Backward Ps Times (default = 1) (CUB).
|
||||
*/
|
||||
public cursorBackward(params: number[]): boolean {
|
||||
public cursorBackward(params: number[]): void {
|
||||
let param = params[0];
|
||||
if (param < 1) {
|
||||
param = 1;
|
||||
@@ -609,7 +598,6 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
if (this._terminal.buffer.x < 0) {
|
||||
this._terminal.buffer.x = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -617,7 +605,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* Cursor Next Line Ps Times (default = 1) (CNL).
|
||||
* same as CSI Ps B ?
|
||||
*/
|
||||
public cursorNextLine(params: number[]): boolean {
|
||||
public cursorNextLine(params: number[]): void {
|
||||
let param = params[0];
|
||||
if (param < 1) {
|
||||
param = 1;
|
||||
@@ -627,7 +615,6 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
this._terminal.buffer.y = this._terminal.rows - 1;
|
||||
}
|
||||
this._terminal.buffer.x = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -636,7 +623,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* Cursor Preceding Line Ps Times (default = 1) (CNL).
|
||||
* reuse CSI Ps A ?
|
||||
*/
|
||||
public cursorPrecedingLine(params: number[]): boolean {
|
||||
public cursorPrecedingLine(params: number[]): void {
|
||||
let param = params[0];
|
||||
if (param < 1) {
|
||||
param = 1;
|
||||
@@ -646,7 +633,6 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
this._terminal.buffer.y = 0;
|
||||
}
|
||||
this._terminal.buffer.x = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -654,20 +640,19 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* CSI Ps G
|
||||
* Cursor Character Absolute [column] (default = [row,1]) (CHA).
|
||||
*/
|
||||
public cursorCharAbsolute(params: number[]): boolean {
|
||||
public cursorCharAbsolute(params: number[]): void {
|
||||
let param = params[0];
|
||||
if (param < 1) {
|
||||
param = 1;
|
||||
}
|
||||
this._terminal.buffer.x = param - 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Ps ; Ps H
|
||||
* Cursor Position [row;column] (default = [1,1]) (CUP).
|
||||
*/
|
||||
public cursorPosition(params: number[]): boolean {
|
||||
public cursorPosition(params: number[]): void {
|
||||
let col: number;
|
||||
let row: number = params[0] - 1;
|
||||
|
||||
@@ -691,19 +676,17 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
|
||||
this._terminal.buffer.x = col;
|
||||
this._terminal.buffer.y = row;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Ps I
|
||||
* Cursor Forward Tabulation Ps tab stops (default = 1) (CHT).
|
||||
*/
|
||||
public cursorForwardTab(params: number[]): boolean {
|
||||
public cursorForwardTab(params: number[]): void {
|
||||
let param = params[0] || 1;
|
||||
while (param--) {
|
||||
this._terminal.buffer.x = this._terminal.buffer.nextStop();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -746,7 +729,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* Ps = 1 -> Selective Erase Above.
|
||||
* Ps = 2 -> Selective Erase All.
|
||||
*/
|
||||
public eraseInDisplay(params: number[]): boolean {
|
||||
public eraseInDisplay(params: number[]): void {
|
||||
let j;
|
||||
switch (params[0]) {
|
||||
case 0:
|
||||
@@ -792,7 +775,6 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -806,7 +788,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* Ps = 1 -> Selective Erase to Left.
|
||||
* Ps = 2 -> Selective Erase All.
|
||||
*/
|
||||
public eraseInLine(params: number[]): boolean {
|
||||
public eraseInLine(params: number[]): void {
|
||||
switch (params[0]) {
|
||||
case 0:
|
||||
this._eraseInBufferLine(this._terminal.buffer.y, this._terminal.buffer.x, this._terminal.cols);
|
||||
@@ -819,14 +801,13 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
break;
|
||||
}
|
||||
this._terminal.updateRange(this._terminal.buffer.y);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Ps L
|
||||
* Insert Ps Line(s) (default = 1) (IL).
|
||||
*/
|
||||
public insertLines(params: number[]): boolean {
|
||||
public insertLines(params: number[]): void {
|
||||
let param: number = params[0];
|
||||
if (param < 1) {
|
||||
param = 1;
|
||||
@@ -849,14 +830,13 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
// this.maxRange();
|
||||
this._terminal.updateRange(buffer.y);
|
||||
this._terminal.updateRange(buffer.scrollBottom);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Ps M
|
||||
* Delete Ps Line(s) (default = 1) (DL).
|
||||
*/
|
||||
public deleteLines(params: number[]): boolean {
|
||||
public deleteLines(params: number[]): void {
|
||||
let param = params[0];
|
||||
if (param < 1) {
|
||||
param = 1;
|
||||
@@ -880,27 +860,25 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
// this.maxRange();
|
||||
this._terminal.updateRange(buffer.y);
|
||||
this._terminal.updateRange(buffer.scrollBottom);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Ps P
|
||||
* Delete Ps Character(s) (default = 1) (DCH).
|
||||
*/
|
||||
public deleteChars(params: number[]): boolean {
|
||||
public deleteChars(params: number[]): void {
|
||||
this._terminal.buffer.lines.get(this._terminal.buffer.y + this._terminal.buffer.ybase).deleteCells(
|
||||
this._terminal.buffer.x,
|
||||
params[0] || 1,
|
||||
this._terminal.buffer.getNullCell(this._terminal.eraseAttr())
|
||||
);
|
||||
this._terminal.updateRange(this._terminal.buffer.y);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Ps S Scroll up Ps lines (default = 1) (SU).
|
||||
*/
|
||||
public scrollUp(params: number[]): boolean {
|
||||
public scrollUp(params: number[]): void {
|
||||
let param = params[0] || 1;
|
||||
|
||||
// make buffer local for faster access
|
||||
@@ -913,13 +891,12 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
// this.maxRange();
|
||||
this._terminal.updateRange(buffer.scrollTop);
|
||||
this._terminal.updateRange(buffer.scrollBottom);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Ps T Scroll down Ps lines (default = 1) (SD).
|
||||
*/
|
||||
public scrollDown(params: number[], collect?: string): boolean {
|
||||
public scrollDown(params: number[], collect?: string): void {
|
||||
if (params.length < 2 && !collect) {
|
||||
let param = params[0] || 1;
|
||||
|
||||
@@ -934,26 +911,24 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
this._terminal.updateRange(buffer.scrollTop);
|
||||
this._terminal.updateRange(buffer.scrollBottom);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Ps X
|
||||
* Erase Ps Character(s) (default = 1) (ECH).
|
||||
*/
|
||||
public eraseChars(params: number[]): boolean {
|
||||
public eraseChars(params: number[]): void {
|
||||
this._terminal.buffer.lines.get(this._terminal.buffer.y + this._terminal.buffer.ybase).replaceCells(
|
||||
this._terminal.buffer.x,
|
||||
this._terminal.buffer.x + (params[0] || 1),
|
||||
this._terminal.buffer.getNullCell(this._terminal.eraseAttr())
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).
|
||||
*/
|
||||
public cursorBackwardTab(params: number[]): boolean {
|
||||
public cursorBackwardTab(params: number[]): void {
|
||||
let param = params[0] || 1;
|
||||
|
||||
// make buffer local for faster access
|
||||
@@ -962,14 +937,13 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
while (param--) {
|
||||
buffer.x = buffer.prevStop();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Pm ` Character Position Absolute
|
||||
* [column] (default = [row,1]) (HPA).
|
||||
*/
|
||||
public charPosAbsolute(params: number[]): boolean {
|
||||
public charPosAbsolute(params: number[]): void {
|
||||
let param = params[0];
|
||||
if (param < 1) {
|
||||
param = 1;
|
||||
@@ -978,7 +952,6 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
if (this._terminal.buffer.x >= this._terminal.cols) {
|
||||
this._terminal.buffer.x = this._terminal.cols - 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -986,7 +959,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* [columns] (default = [row,col+1]) (HPR)
|
||||
* reuse CSI Ps C ?
|
||||
*/
|
||||
public hPositionRelative(params: number[]): boolean {
|
||||
public hPositionRelative(params: number[]): void {
|
||||
let param = params[0];
|
||||
if (param < 1) {
|
||||
param = 1;
|
||||
@@ -995,13 +968,12 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
if (this._terminal.buffer.x >= this._terminal.cols) {
|
||||
this._terminal.buffer.x = this._terminal.cols - 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Ps b Repeat the preceding graphic character Ps times (REP).
|
||||
*/
|
||||
public repeatPrecedingCharacter(params: number[]): boolean {
|
||||
public repeatPrecedingCharacter(params: number[]): void {
|
||||
// make buffer local for faster access
|
||||
const buffer = this._terminal.buffer;
|
||||
const line = buffer.lines.get(buffer.ybase + buffer.y);
|
||||
@@ -1011,7 +983,6 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
(this._workCell.content !== undefined) ? this._workCell : buffer.getNullCell(DEFAULT_ATTR)
|
||||
);
|
||||
// FIXME: no updateRange here?
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1051,9 +1022,9 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* xterm/charproc.c - line 2012, for more information.
|
||||
* vim responds with ^[[?0c or ^[[?1c after the terminal's response (?)
|
||||
*/
|
||||
public sendDeviceAttributes(params: number[], collect?: string): boolean {
|
||||
public sendDeviceAttributes(params: number[], collect?: string): void {
|
||||
if (params[0] > 0) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!collect) {
|
||||
@@ -1078,14 +1049,13 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
this._terminal.handler(C0.ESC + '[>83;40003;0c');
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI Pm d Vertical Position Absolute (VPA)
|
||||
* [row] (default = [1,column])
|
||||
*/
|
||||
public linePosAbsolute(params: number[]): boolean {
|
||||
public linePosAbsolute(params: number[]): void {
|
||||
let param = params[0];
|
||||
if (param < 1) {
|
||||
param = 1;
|
||||
@@ -1094,7 +1064,6 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
if (this._terminal.buffer.y >= this._terminal.rows) {
|
||||
this._terminal.buffer.y = this._terminal.rows - 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1102,7 +1071,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* [rows] (default = [row+1,column])
|
||||
* reuse CSI Ps B ?
|
||||
*/
|
||||
public vPositionRelative(params: number[]): boolean {
|
||||
public vPositionRelative(params: number[]): void {
|
||||
let param = params[0];
|
||||
if (param < 1) {
|
||||
param = 1;
|
||||
@@ -1115,7 +1084,6 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
if (this._terminal.buffer.x >= this._terminal.cols) {
|
||||
this._terminal.buffer.x--;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1123,7 +1091,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* Horizontal and Vertical Position [row;column] (default =
|
||||
* [1,1]) (HVP).
|
||||
*/
|
||||
public hVPosition(params: number[]): boolean {
|
||||
public hVPosition(params: number[]): void {
|
||||
if (params[0] < 1) params[0] = 1;
|
||||
if (params[1] < 1) params[1] = 1;
|
||||
|
||||
@@ -1136,7 +1104,6 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
if (this._terminal.buffer.x >= this._terminal.cols) {
|
||||
this._terminal.buffer.x = this._terminal.cols - 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1147,14 +1114,13 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* Ps = 2 -> Clear Stops on Line.
|
||||
* http://vt100.net/annarbor/aaa-ug/section6.html
|
||||
*/
|
||||
public tabClear(params: number[]): boolean {
|
||||
public tabClear(params: number[]): void {
|
||||
const param = params[0];
|
||||
if (param <= 0) {
|
||||
delete this._terminal.buffer.tabs[this._terminal.buffer.x];
|
||||
} else if (param === 3) {
|
||||
this._terminal.buffer.tabs = {};
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1243,13 +1209,13 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* Modes:
|
||||
* http: *vt100.net/docs/vt220-rm/chapter4.html
|
||||
*/
|
||||
public setMode(params: number[], collect?: string): boolean {
|
||||
public setMode(params: number[], collect?: string): void {
|
||||
if (params.length > 1) {
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
this.setMode([params[i]]);
|
||||
}
|
||||
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!collect) {
|
||||
@@ -1364,7 +1330,6 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1449,13 +1414,13 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC style.
|
||||
* Ps = 2 0 0 4 -> Reset bracketed paste mode.
|
||||
*/
|
||||
public resetMode(params: number[], collect?: string): boolean {
|
||||
public resetMode(params: number[], collect?: string): void {
|
||||
if (params.length > 1) {
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
this.resetMode([params[i]]);
|
||||
}
|
||||
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!collect) {
|
||||
@@ -1547,7 +1512,6 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1615,11 +1579,11 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* Ps = 4 8 ; 5 ; Ps -> Set background color to the second
|
||||
* Ps.
|
||||
*/
|
||||
public charAttributes(params: number[]): boolean {
|
||||
public charAttributes(params: number[]): void {
|
||||
// Optimize a single SGR0.
|
||||
if (params.length === 1 && params[0] === 0) {
|
||||
this._terminal.curAttr = DEFAULT_ATTR;
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
const l = params.length;
|
||||
@@ -1739,8 +1703,6 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
}
|
||||
|
||||
this._terminal.curAttr = (flags << 18) | (fg << 9) | bg;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1766,7 +1728,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* CSI ? 5 3 n Locator available, if compiled-in, or
|
||||
* CSI ? 5 0 n No Locator, if not.
|
||||
*/
|
||||
public deviceStatus(params: number[], collect?: string): boolean {
|
||||
public deviceStatus(params: number[], collect?: string): void {
|
||||
if (!collect) {
|
||||
switch (params[0]) {
|
||||
case 5:
|
||||
@@ -1808,14 +1770,13 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSI ! p Soft terminal reset (DECSTR).
|
||||
* http://vt100.net/docs/vt220-rm/table4-10.html
|
||||
*/
|
||||
public softReset(params: number[], collect?: string): boolean {
|
||||
public softReset(params: number[], collect?: string): void {
|
||||
if (collect === '!') {
|
||||
this._terminal.cursorHidden = false;
|
||||
this._terminal.insertMode = false;
|
||||
@@ -1834,7 +1795,6 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
this._terminal.glevel = 0; // ??
|
||||
this._terminal.charsets = [null]; // ??
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1847,7 +1807,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* Ps = 5 -> blinking bar (xterm).
|
||||
* Ps = 6 -> steady bar (xterm).
|
||||
*/
|
||||
public setCursorStyle(params?: number[], collect?: string): boolean {
|
||||
public setCursorStyle(params?: number[], collect?: string): void {
|
||||
if (collect === ' ') {
|
||||
const param = params[0] < 1 ? 1 : params[0];
|
||||
switch (param) {
|
||||
@@ -1867,7 +1827,6 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
const isBlinking = param % 2 === 1;
|
||||
this._terminal.setOption('cursorBlink', isBlinking);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1876,15 +1835,14 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* dow) (DECSTBM).
|
||||
* CSI ? Pm r
|
||||
*/
|
||||
public setScrollRegion(params: number[], collect?: string): boolean {
|
||||
public setScrollRegion(params: number[], collect?: string): void {
|
||||
if (collect) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
this._terminal.buffer.scrollTop = (params[0] || 1) - 1;
|
||||
this._terminal.buffer.scrollBottom = (params[1] && params[1] <= this._terminal.rows ? params[1] : this._terminal.rows) - 1;
|
||||
this._terminal.buffer.x = 0;
|
||||
this._terminal.buffer.y = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1893,11 +1851,10 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* ESC 7
|
||||
* Save cursor (ANSI.SYS).
|
||||
*/
|
||||
public saveCursor(params: number[]): boolean {
|
||||
public saveCursor(params: number[]): void {
|
||||
this._terminal.buffer.savedX = this._terminal.buffer.x;
|
||||
this._terminal.buffer.savedY = this._terminal.buffer.y;
|
||||
this._terminal.buffer.savedCurAttr = this._terminal.curAttr;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1906,11 +1863,10 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* ESC 8
|
||||
* Restore cursor (ANSI.SYS).
|
||||
*/
|
||||
public restoreCursor(params: number[]): boolean {
|
||||
public restoreCursor(params: number[]): void {
|
||||
this._terminal.buffer.x = this._terminal.buffer.savedX || 0;
|
||||
this._terminal.buffer.y = this._terminal.buffer.savedY || 0;
|
||||
this._terminal.curAttr = this._terminal.buffer.savedCurAttr || DEFAULT_ATTR;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1919,9 +1875,8 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* OSC 2; <data> ST (set window title)
|
||||
* Proxy to set window title. Icon name is not supported.
|
||||
*/
|
||||
public setTitle(data: string): boolean {
|
||||
public setTitle(data: string): void {
|
||||
this._terminal.handleTitle(data);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1930,10 +1885,9 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* DEC mnemonic: NEL (https://vt100.net/docs/vt510-rm/NEL)
|
||||
* Moves cursor to first position on next line.
|
||||
*/
|
||||
public nextLine(): boolean {
|
||||
public nextLine(): void {
|
||||
this._terminal.buffer.x = 0;
|
||||
this.index();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1941,13 +1895,12 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* DEC mnemonic: DECKPAM (https://vt100.net/docs/vt510-rm/DECKPAM.html)
|
||||
* Enables the numeric keypad to send application sequences to the host.
|
||||
*/
|
||||
public keypadApplicationMode(): boolean {
|
||||
public keypadApplicationMode(): void {
|
||||
this._terminal.log('Serial port requested application keypad.');
|
||||
this._terminal.applicationKeypad = true;
|
||||
if (this._terminal.viewport) {
|
||||
this._terminal.viewport.syncScrollArea();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1955,13 +1908,12 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* DEC mnemonic: DECKPNM (https://vt100.net/docs/vt510-rm/DECKPNM.html)
|
||||
* Enables the keypad to send numeric characters to the host.
|
||||
*/
|
||||
public keypadNumericMode(): boolean {
|
||||
public keypadNumericMode(): void {
|
||||
this._terminal.log('Switching back to normal keypad.');
|
||||
this._terminal.applicationKeypad = false;
|
||||
if (this._terminal.viewport) {
|
||||
this._terminal.viewport.syncScrollArea();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1970,10 +1922,9 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* Select default character set. UTF-8 is not supported (string are unicode anyways)
|
||||
* therefore ESC % G does the same.
|
||||
*/
|
||||
public selectDefaultCharset(): boolean {
|
||||
public selectDefaultCharset(): void {
|
||||
this._terminal.setgLevel(0);
|
||||
this._terminal.setgCharset(0, DEFAULT_CHARSET); // US (default)
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1992,15 +1943,16 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* ESC / C
|
||||
* Designate G3 Character Set (VT300). C = A -> ISO Latin-1 Supplemental. - Supported?
|
||||
*/
|
||||
public selectCharset(collectAndFlag: string): boolean {
|
||||
public selectCharset(collectAndFlag: string): void {
|
||||
if (collectAndFlag.length !== 2) {
|
||||
return this.selectDefaultCharset();
|
||||
this.selectDefaultCharset();
|
||||
return;
|
||||
}
|
||||
if (collectAndFlag[0] === '/') {
|
||||
return true; // TODO: Is this supported?
|
||||
return; // TODO: Is this supported?
|
||||
}
|
||||
this._terminal.setgCharset(GLEVEL[collectAndFlag[0]], CHARSETS[collectAndFlag[1]] || DEFAULT_CHARSET);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2009,9 +1961,8 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* DEC mnemonic: IND (https://vt100.net/docs/vt510-rm/IND.html)
|
||||
* Moves the cursor down one line in the same column.
|
||||
*/
|
||||
public index(): boolean {
|
||||
public index(): void {
|
||||
this._terminal.index(); // TODO: save to move from terminal?
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2021,9 +1972,8 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* Sets a horizontal tab stop at the column position indicated by
|
||||
* the value of the active column when the terminal receives an HTS.
|
||||
*/
|
||||
public tabSet(): boolean {
|
||||
public tabSet(): void {
|
||||
this._terminal.tabSet(); // TODO: save to move from terminal?
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2033,9 +1983,8 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* Moves the cursor up one line in the same column. If the cursor is at the top margin,
|
||||
* the page scrolls down.
|
||||
*/
|
||||
public reverseIndex(): boolean {
|
||||
public reverseIndex(): void {
|
||||
this._terminal.reverseIndex(); // TODO: save to move from terminal?
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2043,10 +1992,9 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* DEC mnemonic: RIS (https://vt100.net/docs/vt510-rm/RIS.html)
|
||||
* Reset to initial state.
|
||||
*/
|
||||
public reset(): boolean {
|
||||
public reset(): void {
|
||||
this._parser.reset();
|
||||
this._terminal.reset(); // TODO: save to move from terminal?
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2059,8 +2007,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* When you use a locking shift, the character set remains in GL or GR until
|
||||
* you use another locking shift. (partly supported)
|
||||
*/
|
||||
public setgLevel(level: number): boolean {
|
||||
public setgLevel(level: number): void {
|
||||
this._terminal.setgLevel(level); // TODO: save to move from terminal?
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+54
-54
@@ -115,73 +115,73 @@ export interface IInputHandler {
|
||||
addCsiHandler(flag: string, callback: (params: number[], collect: string) => boolean): IDisposable;
|
||||
addOscHandler(ident: number, callback: (data: string) => boolean): IDisposable;
|
||||
|
||||
/** C0 BEL */ bell(): boolean;
|
||||
/** C0 LF */ lineFeed(): boolean;
|
||||
/** C0 CR */ carriageReturn(): boolean;
|
||||
/** C0 BS */ backspace(): boolean;
|
||||
/** C0 HT */ tab(): boolean;
|
||||
/** C0 SO */ shiftOut(): boolean;
|
||||
/** C0 SI */ shiftIn(): boolean;
|
||||
/** C0 BEL */ bell(): void;
|
||||
/** C0 LF */ lineFeed(): void;
|
||||
/** C0 CR */ carriageReturn(): void;
|
||||
/** C0 BS */ backspace(): void;
|
||||
/** C0 HT */ tab(): void;
|
||||
/** C0 SO */ shiftOut(): void;
|
||||
/** C0 SI */ shiftIn(): void;
|
||||
|
||||
/** CSI @ */ insertChars(params?: number[]): boolean;
|
||||
/** CSI A */ cursorUp(params?: number[]): boolean;
|
||||
/** CSI B */ cursorDown(params?: number[]): boolean;
|
||||
/** CSI C */ cursorForward(params?: number[]): boolean;
|
||||
/** CSI D */ cursorBackward(params?: number[]): boolean;
|
||||
/** CSI E */ cursorNextLine(params?: number[]): boolean;
|
||||
/** CSI F */ cursorPrecedingLine(params?: number[]): boolean;
|
||||
/** CSI G */ cursorCharAbsolute(params?: number[]): boolean;
|
||||
/** CSI H */ cursorPosition(params?: number[]): boolean;
|
||||
/** CSI I */ cursorForwardTab(params?: number[]): boolean;
|
||||
/** CSI J */ eraseInDisplay(params?: number[]): boolean;
|
||||
/** CSI K */ eraseInLine(params?: number[]): boolean;
|
||||
/** CSI L */ insertLines(params?: number[]): boolean;
|
||||
/** CSI M */ deleteLines(params?: number[]): boolean;
|
||||
/** CSI P */ deleteChars(params?: number[]): boolean;
|
||||
/** CSI S */ scrollUp(params?: number[]): boolean;
|
||||
/** CSI T */ scrollDown(params?: number[], collect?: string): boolean;
|
||||
/** CSI X */ eraseChars(params?: number[]): boolean;
|
||||
/** CSI Z */ cursorBackwardTab(params?: number[]): boolean;
|
||||
/** CSI ` */ charPosAbsolute(params?: number[]): boolean;
|
||||
/** CSI a */ hPositionRelative(params?: number[]): boolean;
|
||||
/** CSI b */ repeatPrecedingCharacter(params?: number[]): boolean;
|
||||
/** CSI c */ sendDeviceAttributes(params?: number[], collect?: string): boolean;
|
||||
/** CSI d */ linePosAbsolute(params?: number[]): boolean;
|
||||
/** CSI e */ vPositionRelative(params?: number[]): boolean;
|
||||
/** CSI f */ hVPosition(params?: number[]): boolean;
|
||||
/** CSI g */ tabClear(params?: number[]): boolean;
|
||||
/** CSI h */ setMode(params?: number[], collect?: string): boolean;
|
||||
/** CSI l */ resetMode(params?: number[], collect?: string): boolean;
|
||||
/** CSI m */ charAttributes(params?: number[]): boolean;
|
||||
/** CSI n */ deviceStatus(params?: number[], collect?: string): boolean;
|
||||
/** CSI p */ softReset(params?: number[], collect?: string): boolean;
|
||||
/** CSI q */ setCursorStyle(params?: number[], collect?: string): boolean;
|
||||
/** CSI r */ setScrollRegion(params?: number[], collect?: string): boolean;
|
||||
/** CSI s */ saveCursor(params?: number[]): boolean;
|
||||
/** CSI u */ restoreCursor(params?: number[]): boolean;
|
||||
/** CSI @ */ insertChars(params?: number[]): void;
|
||||
/** CSI A */ cursorUp(params?: number[]): void;
|
||||
/** CSI B */ cursorDown(params?: number[]): void;
|
||||
/** CSI C */ cursorForward(params?: number[]): void;
|
||||
/** CSI D */ cursorBackward(params?: number[]): void;
|
||||
/** CSI E */ cursorNextLine(params?: number[]): void;
|
||||
/** CSI F */ cursorPrecedingLine(params?: number[]): void;
|
||||
/** CSI G */ cursorCharAbsolute(params?: number[]): void;
|
||||
/** CSI H */ cursorPosition(params?: number[]): void;
|
||||
/** CSI I */ cursorForwardTab(params?: number[]): void;
|
||||
/** CSI J */ eraseInDisplay(params?: number[]): void;
|
||||
/** CSI K */ eraseInLine(params?: number[]): void;
|
||||
/** CSI L */ insertLines(params?: number[]): void;
|
||||
/** CSI M */ deleteLines(params?: number[]): void;
|
||||
/** CSI P */ deleteChars(params?: number[]): void;
|
||||
/** CSI S */ scrollUp(params?: number[]): void;
|
||||
/** CSI T */ scrollDown(params?: number[], collect?: string): void;
|
||||
/** CSI X */ eraseChars(params?: number[]): void;
|
||||
/** CSI Z */ cursorBackwardTab(params?: number[]): void;
|
||||
/** CSI ` */ charPosAbsolute(params?: number[]): void;
|
||||
/** CSI a */ hPositionRelative(params?: number[]): void;
|
||||
/** CSI b */ repeatPrecedingCharacter(params?: number[]): void;
|
||||
/** CSI c */ sendDeviceAttributes(params?: number[], collect?: string): void;
|
||||
/** CSI d */ linePosAbsolute(params?: number[]): void;
|
||||
/** CSI e */ vPositionRelative(params?: number[]): void;
|
||||
/** CSI f */ hVPosition(params?: number[]): void;
|
||||
/** CSI g */ tabClear(params?: number[]): void;
|
||||
/** CSI h */ setMode(params?: number[], collect?: string): void;
|
||||
/** CSI l */ resetMode(params?: number[], collect?: string): void;
|
||||
/** CSI m */ charAttributes(params?: number[]): void;
|
||||
/** CSI n */ deviceStatus(params?: number[], collect?: string): void;
|
||||
/** CSI p */ softReset(params?: number[], collect?: string): void;
|
||||
/** CSI q */ setCursorStyle(params?: number[], collect?: string): void;
|
||||
/** CSI r */ setScrollRegion(params?: number[], collect?: string): void;
|
||||
/** CSI s */ saveCursor(params?: number[]): void;
|
||||
/** CSI u */ restoreCursor(params?: number[]): void;
|
||||
/** OSC 0
|
||||
OSC 2 */ setTitle(data: string): boolean;
|
||||
/** ESC E */ nextLine(): boolean;
|
||||
/** ESC = */ keypadApplicationMode(): boolean;
|
||||
/** ESC > */ keypadNumericMode(): boolean;
|
||||
OSC 2 */ setTitle(data: string): void;
|
||||
/** ESC E */ nextLine(): void;
|
||||
/** ESC = */ keypadApplicationMode(): void;
|
||||
/** ESC > */ keypadNumericMode(): void;
|
||||
/** ESC % G
|
||||
ESC % @ */ selectDefaultCharset(): boolean;
|
||||
ESC % @ */ selectDefaultCharset(): void;
|
||||
/** ESC ( C
|
||||
ESC ) C
|
||||
ESC * C
|
||||
ESC + C
|
||||
ESC - C
|
||||
ESC . C
|
||||
ESC / C */ selectCharset(collectAndFlag: string): boolean;
|
||||
/** ESC D */ index(): boolean;
|
||||
/** ESC H */ tabSet(): boolean;
|
||||
/** ESC M */ reverseIndex(): boolean;
|
||||
/** ESC c */ reset(): boolean;
|
||||
ESC / C */ selectCharset(collectAndFlag: string): void;
|
||||
/** ESC D */ index(): void;
|
||||
/** ESC H */ tabSet(): void;
|
||||
/** ESC M */ reverseIndex(): void;
|
||||
/** ESC c */ reset(): void;
|
||||
/** ESC n
|
||||
ESC o
|
||||
ESC |
|
||||
ESC }
|
||||
ESC ~ */ setgLevel(level: number): boolean;
|
||||
ESC ~ */ setgLevel(level: number): void;
|
||||
}
|
||||
|
||||
export interface ILinkMatcher {
|
||||
|
||||
Reference in New Issue
Block a user