move doc to impl

This commit is contained in:
Jörg Breitbart
2020-01-05 22:41:36 +01:00
parent aec2baa7e7
commit a0d724c186
+152 -130
View File
@@ -32,6 +32,7 @@ const GLEVEL: {[key: string]: number} = {'(': 0, ')': 1, '*': 2, '+': 3, '-': 1,
* Document common VT features here that are currently unsupported * Document common VT features here that are currently unsupported
*/ */
// @vt: unsupported DCS SIXEL "SIXEL Graphics" "DCS Ps ; Ps ; Ps ; q Pt ST" "Draw SIXEL image starting at cursor position." // @vt: unsupported DCS SIXEL "SIXEL Graphics" "DCS Ps ; Ps ; Ps ; q Pt ST" "Draw SIXEL image starting at cursor position."
// @vt: unsupported OSC 1 "Set Icon Name" "OSC 1 ; Pt BEL" "Set icon name."
/** /**
* Max length of the UTF32 input buffer. Real memory consumption is 4 times higher. * Max length of the UTF32 input buffer. Real memory consumption is 4 times higher.
@@ -201,200 +202,77 @@ export class InputHandler extends Disposable implements IInputHandler {
* CSI handler * CSI handler
*/ */
this._parser.setCsiHandler({final: '@'}, params => this.insertChars(params)); this._parser.setCsiHandler({final: '@'}, params => this.insertChars(params));
// @vt: supported CSI SL "Scroll Left" "CSI Ps SP @" "Scroll viewport `Ps` times to the left."
this._parser.setCsiHandler({intermediates: ' ', final: '@'}, params => this.scrollLeft(params)); this._parser.setCsiHandler({intermediates: ' ', final: '@'}, params => this.scrollLeft(params));
// @vt: supported CSI CUU "Cursor Up" "CSI Ps A" "Move cursor `Ps` times up (default=1)."
this._parser.setCsiHandler({final: 'A'}, params => this.cursorUp(params)); this._parser.setCsiHandler({final: 'A'}, params => this.cursorUp(params));
// @vt: supported CSI SR "Scroll Right" "CSI Ps SP A" "Scroll viewport `Ps` times to the right."
this._parser.setCsiHandler({intermediates: ' ', final: 'A'}, params => this.scrollRight(params)); this._parser.setCsiHandler({intermediates: ' ', final: 'A'}, params => this.scrollRight(params));
// @vt: supported CSI CUD "Cursor Down" "CSI Ps B" "Move cursor `Ps` times down (default=1)."
this._parser.setCsiHandler({final: 'B'}, params => this.cursorDown(params)); this._parser.setCsiHandler({final: 'B'}, params => this.cursorDown(params));
// @vt: supported CSI CUF "Cursor Forward" "CSI Ps C" "Move cursor `Ps` times forward (default=1)."
this._parser.setCsiHandler({final: 'C'}, params => this.cursorForward(params)); this._parser.setCsiHandler({final: 'C'}, params => this.cursorForward(params));
// @vt: supported CSI CUB "Cursor Backward" "CSI Ps D" "Move cursor `Ps` times backward (default=1)."
this._parser.setCsiHandler({final: 'D'}, params => this.cursorBackward(params)); this._parser.setCsiHandler({final: 'D'}, params => this.cursorBackward(params));
// @vt: supported CSI CNL "Cursor Next Line" "CSI Ps E" "Move cursor `Ps` times down (default=1) and to the first column."
this._parser.setCsiHandler({final: 'E'}, params => this.cursorNextLine(params)); this._parser.setCsiHandler({final: 'E'}, params => this.cursorNextLine(params));
// @vt: supported CSI CPL "Cursor Backward" "CSI Ps F" "Move cursor `Ps` times up (default=1) and to the first column."
this._parser.setCsiHandler({final: 'F'}, params => this.cursorPrecedingLine(params)); this._parser.setCsiHandler({final: 'F'}, params => this.cursorPrecedingLine(params));
// @vt: supported CSI CHA "Cursor Horizontal Absolute" "CSI Ps G" "Move cursor to `Ps`-th column of the active row (default=1)."
this._parser.setCsiHandler({final: 'G'}, params => this.cursorCharAbsolute(params)); this._parser.setCsiHandler({final: 'G'}, params => this.cursorCharAbsolute(params));
// @vt: supported CSI CUP "Cursor Position" "CSI Ps ; Ps H" "Set cursor to position [`Ps`, `Ps`]."
this._parser.setCsiHandler({final: 'H'}, params => this.cursorPosition(params)); this._parser.setCsiHandler({final: 'H'}, params => this.cursorPosition(params));
// @vt: supported CSI CHT "Cursor Horizontal Tabulation" "CSI Ps I" "Move cursor `Ps` times tabs forward (default=1)."
this._parser.setCsiHandler({final: 'I'}, params => this.cursorForwardTab(params)); this._parser.setCsiHandler({final: 'I'}, params => this.cursorForwardTab(params));
/**
* @vt: supported CSI ED "Erase In Display" "CSI Ps J" "Erase various parts of the viewport."
* TODO: document different modes...
*/
this._parser.setCsiHandler({final: 'J'}, params => this.eraseInDisplay(params)); this._parser.setCsiHandler({final: 'J'}, params => this.eraseInDisplay(params));
// @vt: partly CSI DECSED "Selective Erase In Display" "CSI ? Ps J" "Currently the same as ED."
this._parser.setCsiHandler({prefix: '?', final: 'J'}, params => this.eraseInDisplay(params)); this._parser.setCsiHandler({prefix: '?', final: 'J'}, params => this.eraseInDisplay(params));
/**
* @vt: supported CSI EL "Erase In Line" "CSI Ps K" "Erase various parts of the active row."
* TODO: document different modes...
*/
this._parser.setCsiHandler({final: 'K'}, params => this.eraseInLine(params)); this._parser.setCsiHandler({final: 'K'}, params => this.eraseInLine(params));
// @vt: partly CSI DECSEL "Selective Erase In Line" "CSI ? Ps K" "Currently the same as EL."
this._parser.setCsiHandler({prefix: '?', final: 'K'}, params => this.eraseInLine(params)); this._parser.setCsiHandler({prefix: '?', final: 'K'}, params => this.eraseInLine(params));
// @vt: supported CSI IL "Insert Line" "CSI Ps L" "Insert `Ps` blank lines at active row (default=1)."
this._parser.setCsiHandler({final: 'L'}, params => this.insertLines(params)); this._parser.setCsiHandler({final: 'L'}, params => this.insertLines(params));
// @vt: supported CSI DL "Delete Line" "CSI Ps M" "Delete `Ps` lines at active row (default=1)."
this._parser.setCsiHandler({final: 'M'}, params => this.deleteLines(params)); this._parser.setCsiHandler({final: 'M'}, params => this.deleteLines(params));
// @vt: supported CSI DCH "Delete Character" "CSI Ps P" "Delete `Ps` characters in the active row (default=1)."
this._parser.setCsiHandler({final: 'P'}, params => this.deleteChars(params)); this._parser.setCsiHandler({final: 'P'}, params => this.deleteChars(params));
// @vt: supported CSI SU "Scroll Up" "CSI Ps S" "Scroll `Ps` lines up (default=1)."
this._parser.setCsiHandler({final: 'S'}, params => this.scrollUp(params)); this._parser.setCsiHandler({final: 'S'}, params => this.scrollUp(params));
// @vt: supported CSI SD "Scroll Down" "CSI Ps T" "Scroll `Ps` lines down (default=1)."
this._parser.setCsiHandler({final: 'T'}, params => this.scrollDown(params)); this._parser.setCsiHandler({final: 'T'}, params => this.scrollDown(params));
// @vt: supported CSI ECH "Erase Character" "CSI Ps X" "Erase `Ps` characters from current cursor position to hte right (default=1)."
this._parser.setCsiHandler({final: 'X'}, params => this.eraseChars(params)); this._parser.setCsiHandler({final: 'X'}, params => this.eraseChars(params));
// @vt: supported CSI CBT "Cursor Backward Tabulation" "CSI Ps Z" "Move cursor `Ps` tabs backward (default=1)."
this._parser.setCsiHandler({final: 'Z'}, params => this.cursorBackwardTab(params)); this._parser.setCsiHandler({final: 'Z'}, params => this.cursorBackwardTab(params));
// @vt: supported CSI HPA "Horizontal Position Absolute" "CSI Ps `" "Same as CHA."
this._parser.setCsiHandler({final: '`'}, params => this.charPosAbsolute(params)); this._parser.setCsiHandler({final: '`'}, params => this.charPosAbsolute(params));
// @vt: supported CSI HPR "Horizontal Position Relative" "CSI Ps a" "Same as CUF."
this._parser.setCsiHandler({final: 'a'}, params => this.hPositionRelative(params)); this._parser.setCsiHandler({final: 'a'}, params => this.hPositionRelative(params));
/**
* @vt: supported CSI REP "Repeat Preceding Character" "CSI Ps b" "Repeat preceding character `Ps` times (default=1)."
* Has no effect if the sequence does not follow a printed character (NOOP for any other sequence in between).
* TODO: document character limitations due to xterm compliance
*/
this._parser.setCsiHandler({final: 'b'}, params => this.repeatPrecedingCharacter(params)); this._parser.setCsiHandler({final: 'b'}, params => this.repeatPrecedingCharacter(params));
/**
* @vt: supported CSI DA1 "Primary Device Attributes" "CSI c" "Send primary device attributes."
* TODO: Describe response...
*/
this._parser.setCsiHandler({final: 'c'}, params => this.sendDeviceAttributesPrimary(params)); this._parser.setCsiHandler({final: 'c'}, params => this.sendDeviceAttributesPrimary(params));
/**
* @vt: supported CSI DA2 "Secondary Device Attributes" "CSI > c" "Send primary device attributes."
* TODO: Describe response...
*/
this._parser.setCsiHandler({prefix: '>', final: 'c'}, params => this.sendDeviceAttributesSecondary(params)); this._parser.setCsiHandler({prefix: '>', final: 'c'}, params => this.sendDeviceAttributesSecondary(params));
// @vt: supported CSI VPA "Vertical Position Absolute" "CSI Ps d" "Move cursor to `Ps`-th row (default=1)."
this._parser.setCsiHandler({final: 'd'}, params => this.linePosAbsolute(params)); this._parser.setCsiHandler({final: 'd'}, params => this.linePosAbsolute(params));
// @vt: supported CSI VPR "Vertical Position Relative" "CSI Ps e" "Move cursor `Ps` times down (default=1)."
this._parser.setCsiHandler({final: 'e'}, params => this.vPositionRelative(params)); this._parser.setCsiHandler({final: 'e'}, params => this.vPositionRelative(params));
// @vt: supported CSI HVP "Horizontal and Vertical Position" "CSI Ps ; Ps f" "Same as CUP."
this._parser.setCsiHandler({final: 'f'}, params => this.hVPosition(params)); this._parser.setCsiHandler({final: 'f'}, params => this.hVPosition(params));
// @vt: supported CSI TBC "Tab Clear" "CSI Ps g" "Clear tab stops at current position (0) or all (3) (default=0)."
this._parser.setCsiHandler({final: 'g'}, params => this.tabClear(params)); this._parser.setCsiHandler({final: 'g'}, params => this.tabClear(params));
/**
* @vt: partly CSI SM "Set Mode" "CSI Pm h" "Set various terminal attributes."
* TODO: Describe all supported attributes.
*/
this._parser.setCsiHandler({final: 'h'}, params => this.setMode(params)); this._parser.setCsiHandler({final: 'h'}, params => this.setMode(params));
/**
* @vt: partly CSI DECSET "DEC Private Set Mode" "CSI ? Pm h" "Set various terminal attributes."
* TODO: Describe all supported attributes.
*/
this._parser.setCsiHandler({prefix: '?', final: 'h'}, params => this.setModePrivate(params)); this._parser.setCsiHandler({prefix: '?', final: 'h'}, params => this.setModePrivate(params));
/**
* @vt: partly CSI RM "Reset Mode" "CSI Pm l" "Set various terminal attributes."
* TODO: Describe all supported attributes.
*/
this._parser.setCsiHandler({final: 'l'}, params => this.resetMode(params)); this._parser.setCsiHandler({final: 'l'}, params => this.resetMode(params));
/**
* @vt: partly CSI DECRST "DEC Private Reset Mode" "CSI ? Pm l" "Reset various terminal attributes."
* TODO: Describe all supported attributes.
*/
this._parser.setCsiHandler({prefix: '?', final: 'l'}, params => this.resetModePrivate(params)); this._parser.setCsiHandler({prefix: '?', final: 'l'}, params => this.resetModePrivate(params));
/**
* @vt: partly CSI SGR "Select Graphic Rendition" "CSI Pm m" "Reset various text attributes."
* Detailed description goes here...
*/
this._parser.setCsiHandler({final: 'm'}, params => this.charAttributes(params)); this._parser.setCsiHandler({final: 'm'}, params => this.charAttributes(params));
// @vt: supported CSI DSR "Device Status Report" "CSI Ps n" "Request cursor position (CPR) with `Ps` = 6."
this._parser.setCsiHandler({final: 'n'}, params => this.deviceStatus(params)); this._parser.setCsiHandler({final: 'n'}, params => this.deviceStatus(params));
// @vt: partly CSI DECDSR "DEC Device Status Report" "CSI ? Ps n" "Only CPR is supported (same as DSR)."
this._parser.setCsiHandler({prefix: '?', final: 'n'}, params => this.deviceStatusPrivate(params)); this._parser.setCsiHandler({prefix: '?', final: 'n'}, params => this.deviceStatusPrivate(params));
/**
* @vt: supported CSI DECSTR "Soft Terminal Reset" "CSI ! p" "Reset several terminal attributes to initial state."
* There are two terminal reset sequences - RIS and DECSTR. While RIS performs almost a full terminal bootstrap,
* DECSTR only resets certain attributes. For most needs DECSTR should be sufficient.
* Attributes reset to default values:
* - TODO: list attributes here ...
*/
this._parser.setCsiHandler({intermediates: '!', final: 'p'}, params => this.softReset(params)); this._parser.setCsiHandler({intermediates: '!', final: 'p'}, params => this.softReset(params));
/**
* @vt: supported CSI DECSCUSR "Set Cursor Style" "CSI Ps SP q" "Set cursor style."
* Supported cursor styles (note that most renderers dont implement the blink feature,
* thus will show the steady variant instead):
* - empty, 0 or 1: steady block
* - 2: blink block
* - 3: steady underline
* - 4: blink underline
* - 5: steady bar
* - 6: blink bar
*/
this._parser.setCsiHandler({intermediates: ' ', final: 'q'}, params => this.setCursorStyle(params)); this._parser.setCsiHandler({intermediates: ' ', final: 'q'}, params => this.setCursorStyle(params));
/**
* @vt: supported CSI DECSTBM "Set Top and Bottom Margin" "CSI Ps ; Ps r" "Set top and bottom margins of the viewport [top;bottom] (default = viewport size)."
* TODO: document specialties like dependent cursor commands and scrolling...
*/
this._parser.setCsiHandler({final: 'r'}, params => this.setScrollRegion(params)); this._parser.setCsiHandler({final: 'r'}, params => this.setScrollRegion(params));
// @vt: partly CSI SCOSC "Save Cursor" "CSI s" "Save cursor position, charmap and text attributes."
this._parser.setCsiHandler({final: 's'}, params => this.saveCursor(params)); this._parser.setCsiHandler({final: 's'}, params => this.saveCursor(params));
// @vt: partly CSI SCORC "Restore Cursor" "CSI u" "Restore cursor position, charmap and text attributes."
this._parser.setCsiHandler({final: 'u'}, params => this.restoreCursor(params)); this._parser.setCsiHandler({final: 'u'}, params => this.restoreCursor(params));
// @vt: supported CSI DECIC "Insert Columns" "CSI Ps ' }" "Insert `Ps` columns at cursor position."
this._parser.setCsiHandler({intermediates: '\'', final: '}'}, params => this.insertColumns(params)); this._parser.setCsiHandler({intermediates: '\'', final: '}'}, params => this.insertColumns(params));
// @vt: supported CSI DECDC "Delete Columns" "CSI Ps ' ~" "Delete `Ps` columns at cursor position."
this._parser.setCsiHandler({intermediates: '\'', final: '~'}, params => this.deleteColumns(params)); this._parser.setCsiHandler({intermediates: '\'', final: '~'}, params => this.deleteColumns(params));
/** /**
* execute handler * execute handler
*/ */
/**
* @vt: supported C0 BEL "Bell" "\a" "Ring the bell."
* The behavior of the bell is further customizable with `ITerminalOptions.bellStyle`
* and `ITerminalOptions.bellSound`.
*/
this._parser.setExecuteHandler(C0.BEL, () => this.bell()); this._parser.setExecuteHandler(C0.BEL, () => this.bell());
// @vt: supported C0 LF "Line Feed" "\n" "Move the cursor one row down, scrolling if needed."
this._parser.setExecuteHandler(C0.LF, () => this.lineFeed()); this._parser.setExecuteHandler(C0.LF, () => this.lineFeed());
// @vt: supported C0 VT "Vertical Tabulation" "\v" "Treated as LF."
this._parser.setExecuteHandler(C0.VT, () => this.lineFeed()); this._parser.setExecuteHandler(C0.VT, () => this.lineFeed());
// @vt: supported C0 FF "Form Feed" "\f" "Treated as LF."
this._parser.setExecuteHandler(C0.FF, () => this.lineFeed()); this._parser.setExecuteHandler(C0.FF, () => this.lineFeed());
// @vt: supported C0 CR "Carriage Return" "\r" "Move the cursor to the beginning of the row."
this._parser.setExecuteHandler(C0.CR, () => this.carriageReturn()); this._parser.setExecuteHandler(C0.CR, () => this.carriageReturn());
// @vt: supported C0 BS "Backspace" "\b" "Move the cursor one position to the left."
this._parser.setExecuteHandler(C0.BS, () => this.backspace()); this._parser.setExecuteHandler(C0.BS, () => this.backspace());
// @vt: supported C0 HT "Horizontal Tabulation" "\t" "Move the cursor to the next character tab stop."
this._parser.setExecuteHandler(C0.HT, () => this.tab()); this._parser.setExecuteHandler(C0.HT, () => this.tab());
/**
* @vt: partly C0 SO "Shift Out" "\x0e" "Switch to an alternative character set."
* TODO: document supported native character sets and support limitations ...
*/
this._parser.setExecuteHandler(C0.SO, () => this.shiftOut()); this._parser.setExecuteHandler(C0.SO, () => this.shiftOut());
// @vt: supported C0 SI "Shift In" "\x0f" "Return to regular character set after Shift Out."
this._parser.setExecuteHandler(C0.SI, () => this.shiftIn()); this._parser.setExecuteHandler(C0.SI, () => this.shiftIn());
// FIXME: What do to with missing? Old code just added those to print. // FIXME: What do to with missing? Old code just added those to print.
// @vt: supported C1 IND "Index" "\x84" "Move the cursor one line down scrolling if needed."
this._parser.setExecuteHandler(C1.IND, () => this.index()); this._parser.setExecuteHandler(C1.IND, () => this.index());
// @vt: supported C1 NEL "Next Line" "\x85" "Move the cursor to the beginning of the next row."
this._parser.setExecuteHandler(C1.NEL, () => this.nextLine()); this._parser.setExecuteHandler(C1.NEL, () => this.nextLine());
// @vt: supported C1 HTS "Horizontal Tabulation Set" "\x88" "Places a tab stop at the current cursor position."
this._parser.setExecuteHandler(C1.HTS, () => this.tabSet()); this._parser.setExecuteHandler(C1.HTS, () => this.tabSet());
/** /**
* OSC handler * OSC handler
*/ */
// 0 - icon name + title // 0 - icon name + title
/**
* @vt: partly OSC 0 "Set Windows Title and Icon Name" "OSC 0 ; Pt BEL" "Set window title and icon name."
* Icon name is not supported. For Window Title see below.
*/
this._parser.setOscHandler(0, new OscHandler((data: string) => this.setTitle(data))); this._parser.setOscHandler(0, new OscHandler((data: string) => this.setTitle(data)));
// 1 - icon name // 1 - icon name
// @vt: unsupported OSC 1 "Set Icon Name" "OSC 1 ; Pt BEL" "Set icon name."
// 2 - title // 2 - title
/**
* @vt: supported OSC 2 "Set Windows Title" "OSC 2 ; Pt BEL" "Set window title."
* xterm.js does not manipulate the title directly, instead exposes changes via the event `Terminal.onTitleChange`.
*/
this._parser.setOscHandler(2, new OscHandler((data: string) => this.setTitle(data))); this._parser.setOscHandler(2, new OscHandler((data: string) => this.setTitle(data)));
// 3 - set property X in the form "prop=value" // 3 - set property X in the form "prop=value"
// 4 - Change Color Number // 4 - Change Color Number
@@ -432,15 +310,10 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* ESC handlers * ESC handlers
*/ */
// @vt: supported ESC SC "Save Cursor" "ESC 7" "Save cursor position, charmap and text attributes."
this._parser.setEscHandler({final: '7'}, () => this.saveCursor()); this._parser.setEscHandler({final: '7'}, () => this.saveCursor());
// @vt: supported ESC RC "Restore Cursor" "ESC 8" "Restore cursor position, charmap and text attributes."
this._parser.setEscHandler({final: '8'}, () => this.restoreCursor()); this._parser.setEscHandler({final: '8'}, () => this.restoreCursor());
// @vt: supported ESC IND "Index" "ESC D" "Move the cursor one line down scrolling if needed."
this._parser.setEscHandler({final: 'D'}, () => this.index()); this._parser.setEscHandler({final: 'D'}, () => this.index());
// @vt: supported ESC NEL "Next Line" "ESC E" "Move the cursor to the beginning of the next row."
this._parser.setEscHandler({final: 'E'}, () => this.nextLine()); this._parser.setEscHandler({final: 'E'}, () => this.nextLine());
// @vt: supported ESC HTS "Horizontal Tabulation Set" "ESC H" "Places a tab stop at the current cursor position."
this._parser.setEscHandler({final: 'H'}, () => this.tabSet()); this._parser.setEscHandler({final: 'H'}, () => this.tabSet());
// @vt: supported ESC IR "Reverse Index" "ESC M" "Move the cursor one line up scrolling if needed." // @vt: supported ESC IR "Reverse Index" "ESC M" "Move the cursor one line up scrolling if needed."
this._parser.setEscHandler({final: 'M'}, () => this.reverseIndex()); this._parser.setEscHandler({final: 'M'}, () => this.reverseIndex());
@@ -463,7 +336,6 @@ export class InputHandler extends Disposable implements IInputHandler {
this._parser.setEscHandler({intermediates: '.', final: flag}, () => this.selectCharset('.' + flag)); this._parser.setEscHandler({intermediates: '.', final: flag}, () => this.selectCharset('.' + flag));
this._parser.setEscHandler({intermediates: '/', final: flag}, () => this.selectCharset('/' + flag)); // TODO: supported? this._parser.setEscHandler({intermediates: '/', final: flag}, () => this.selectCharset('/' + flag)); // TODO: supported?
} }
// @vt: supported ESC DECALN "Screen Alignment Pattern" "ESC # 8" "Fill viewport with a test pattern (E)."
this._parser.setEscHandler({intermediates: '#', final: '8'}, () => this.screenAlignmentPattern()); this._parser.setEscHandler({intermediates: '#', final: '8'}, () => this.screenAlignmentPattern());
/** /**
@@ -696,6 +568,10 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* BEL * BEL
* Bell (Ctrl-G). * Bell (Ctrl-G).
*
* @vt: supported C0 BEL "Bell" "\a" "Ring the bell."
* The behavior of the bell is further customizable with `ITerminalOptions.bellStyle`
* and `ITerminalOptions.bellSound`.
*/ */
public bell(): void { public bell(): void {
this._onRequestBell.fire(); this._onRequestBell.fire();
@@ -704,7 +580,11 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* LF * LF
* Line Feed or New Line (NL). (LF is Ctrl-J). * Line Feed or New Line (NL). (LF is Ctrl-J).
*
* @vt: supported C0 LF "Line Feed" "\n" "Move the cursor one row down, scrolling if needed."
*/ */
// @vt: supported C0 VT "Vertical Tabulation" "\v" "Treated as LF."
// @vt: supported C0 FF "Form Feed" "\f" "Treated as LF."
public lineFeed(): void { public lineFeed(): void {
// make buffer local for faster access // make buffer local for faster access
const buffer = this._bufferService.buffer; const buffer = this._bufferService.buffer;
@@ -732,6 +612,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CR * CR
* Carriage Return (Ctrl-M). * Carriage Return (Ctrl-M).
*
* @vt: supported C0 CR "Carriage Return" "\r" "Move the cursor to the beginning of the row."
*/ */
public carriageReturn(): void { public carriageReturn(): void {
this._bufferService.buffer.x = 0; this._bufferService.buffer.x = 0;
@@ -740,6 +622,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* BS * BS
* Backspace (Ctrl-H). * Backspace (Ctrl-H).
*
* @vt: supported C0 BS "Backspace" "\b" "Move the cursor one position to the left."
*/ */
public backspace(): void { public backspace(): void {
this._restrictCursor(); this._restrictCursor();
@@ -751,6 +635,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* TAB * TAB
* Horizontal Tab (HT) (Ctrl-I). * Horizontal Tab (HT) (Ctrl-I).
*
* @vt: supported C0 HT "Horizontal Tabulation" "\t" "Move the cursor to the next character tab stop."
*/ */
public tab(): void { public tab(): void {
if (this._bufferService.buffer.x >= this._bufferService.cols) { if (this._bufferService.buffer.x >= this._bufferService.cols) {
@@ -767,6 +653,9 @@ export class InputHandler extends Disposable implements IInputHandler {
* SO * SO
* Shift Out (Ctrl-N) -> Switch to Alternate Character Set. This invokes the * Shift Out (Ctrl-N) -> Switch to Alternate Character Set. This invokes the
* G1 character set. * G1 character set.
*
* @vt: partly C0 SO "Shift Out" "\x0e" "Switch to an alternative character set."
* TODO: document supported native character sets and support limitations ...
*/ */
public shiftOut(): void { public shiftOut(): void {
this._charsetService.setgLevel(1); this._charsetService.setgLevel(1);
@@ -776,6 +665,8 @@ export class InputHandler extends Disposable implements IInputHandler {
* SI * SI
* Shift In (Ctrl-O) -> Switch to Standard Character Set. This invokes the G0 * Shift In (Ctrl-O) -> Switch to Standard Character Set. This invokes the G0
* character set (the default). * character set (the default).
*
* @vt: supported C0 SI "Shift In" "\x0f" "Return to regular character set after Shift Out."
*/ */
public shiftIn(): void { public shiftIn(): void {
this._charsetService.setgLevel(0); this._charsetService.setgLevel(0);
@@ -821,6 +712,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI Ps A * CSI Ps A
* Cursor Up Ps Times (default = 1) (CUU). * Cursor Up Ps Times (default = 1) (CUU).
*
* @vt: supported CSI CUU "Cursor Up" "CSI Ps A" "Move cursor `Ps` times up (default=1)."
*/ */
public cursorUp(params: IParams): void { public cursorUp(params: IParams): void {
// stop at scrollTop // stop at scrollTop
@@ -835,6 +728,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI Ps B * CSI Ps B
* Cursor Down Ps Times (default = 1) (CUD). * Cursor Down Ps Times (default = 1) (CUD).
*
* @vt: supported CSI CUD "Cursor Down" "CSI Ps B" "Move cursor `Ps` times down (default=1)."
*/ */
public cursorDown(params: IParams): void { public cursorDown(params: IParams): void {
// stop at scrollBottom // stop at scrollBottom
@@ -849,6 +744,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI Ps C * CSI Ps C
* Cursor Forward Ps Times (default = 1) (CUF). * Cursor Forward Ps Times (default = 1) (CUF).
*
* @vt: supported CSI CUF "Cursor Forward" "CSI Ps C" "Move cursor `Ps` times forward (default=1)."
*/ */
public cursorForward(params: IParams): void { public cursorForward(params: IParams): void {
this._moveCursor(params.params[0] || 1, 0); this._moveCursor(params.params[0] || 1, 0);
@@ -857,6 +754,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI Ps D * CSI Ps D
* Cursor Backward Ps Times (default = 1) (CUB). * Cursor Backward Ps Times (default = 1) (CUB).
*
* @vt: supported CSI CUB "Cursor Backward" "CSI Ps D" "Move cursor `Ps` times backward (default=1)."
*/ */
public cursorBackward(params: IParams): void { public cursorBackward(params: IParams): void {
this._moveCursor(-(params.params[0] || 1), 0); this._moveCursor(-(params.params[0] || 1), 0);
@@ -866,6 +765,8 @@ export class InputHandler extends Disposable implements IInputHandler {
* CSI Ps E * CSI Ps E
* Cursor Next Line Ps Times (default = 1) (CNL). * Cursor Next Line Ps Times (default = 1) (CNL).
* Other than cursorDown (CUD) also set the cursor to first column. * Other than cursorDown (CUD) also set the cursor to first column.
*
* @vt: supported CSI CNL "Cursor Next Line" "CSI Ps E" "Move cursor `Ps` times down (default=1) and to the first column."
*/ */
public cursorNextLine(params: IParams): void { public cursorNextLine(params: IParams): void {
this.cursorDown(params); this.cursorDown(params);
@@ -876,6 +777,8 @@ export class InputHandler extends Disposable implements IInputHandler {
* CSI Ps F * CSI Ps F
* Cursor Previous Line Ps Times (default = 1) (CPL). * Cursor Previous Line Ps Times (default = 1) (CPL).
* Other than cursorUp (CUU) also set the cursor to first column. * Other than cursorUp (CUU) also set the cursor to first column.
*
* @vt: supported CSI CPL "Cursor Backward" "CSI Ps F" "Move cursor `Ps` times up (default=1) and to the first column."
*/ */
public cursorPrecedingLine(params: IParams): void { public cursorPrecedingLine(params: IParams): void {
this.cursorUp(params); this.cursorUp(params);
@@ -885,6 +788,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI Ps G * CSI Ps G
* Cursor Character Absolute [column] (default = [row,1]) (CHA). * Cursor Character Absolute [column] (default = [row,1]) (CHA).
*
* @vt: supported CSI CHA "Cursor Horizontal Absolute" "CSI Ps G" "Move cursor to `Ps`-th column of the active row (default=1)."
*/ */
public cursorCharAbsolute(params: IParams): void { public cursorCharAbsolute(params: IParams): void {
this._setCursor((params.params[0] || 1) - 1, this._bufferService.buffer.y); this._setCursor((params.params[0] || 1) - 1, this._bufferService.buffer.y);
@@ -893,6 +798,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI Ps ; Ps H * CSI Ps ; Ps H
* Cursor Position [row;column] (default = [1,1]) (CUP). * Cursor Position [row;column] (default = [1,1]) (CUP).
*
* @vt: supported CSI CUP "Cursor Position" "CSI Ps ; Ps H" "Set cursor to position [`Ps`, `Ps`] (default = [1, 1])."
*/ */
public cursorPosition(params: IParams): void { public cursorPosition(params: IParams): void {
this._setCursor( this._setCursor(
@@ -906,6 +813,8 @@ export class InputHandler extends Disposable implements IInputHandler {
* CSI Pm ` Character Position Absolute * CSI Pm ` Character Position Absolute
* [column] (default = [row,1]) (HPA). * [column] (default = [row,1]) (HPA).
* Currently same functionality as CHA. * Currently same functionality as CHA.
*
* @vt: supported CSI HPA "Horizontal Position Absolute" "CSI Ps `" "Same as CHA."
*/ */
public charPosAbsolute(params: IParams): void { public charPosAbsolute(params: IParams): void {
this._setCursor((params.params[0] || 1) - 1, this._bufferService.buffer.y); this._setCursor((params.params[0] || 1) - 1, this._bufferService.buffer.y);
@@ -915,6 +824,8 @@ export class InputHandler extends Disposable implements IInputHandler {
* CSI Pm a Character Position Relative * CSI Pm a Character Position Relative
* [columns] (default = [row,col+1]) (HPR) * [columns] (default = [row,col+1]) (HPR)
* Currently same functionality as CUF. * Currently same functionality as CUF.
*
* @vt: supported CSI HPR "Horizontal Position Relative" "CSI Ps a" "Same as CUF."
*/ */
public hPositionRelative(params: IParams): void { public hPositionRelative(params: IParams): void {
this._moveCursor(params.params[0] || 1, 0); this._moveCursor(params.params[0] || 1, 0);
@@ -923,6 +834,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI Pm d Vertical Position Absolute (VPA) * CSI Pm d Vertical Position Absolute (VPA)
* [row] (default = [1,column]) * [row] (default = [1,column])
*
* @vt: supported CSI VPA "Vertical Position Absolute" "CSI Ps d" "Move cursor to `Ps`-th row (default=1)."
*/ */
public linePosAbsolute(params: IParams): void { public linePosAbsolute(params: IParams): void {
this._setCursor(this._bufferService.buffer.x, (params.params[0] || 1) - 1); this._setCursor(this._bufferService.buffer.x, (params.params[0] || 1) - 1);
@@ -932,6 +845,8 @@ export class InputHandler extends Disposable implements IInputHandler {
* CSI Pm e Vertical Position Relative (VPR) * CSI Pm e Vertical Position Relative (VPR)
* [rows] (default = [row+1,column]) * [rows] (default = [row+1,column])
* reuse CSI Ps B ? * reuse CSI Ps B ?
*
* @vt: supported CSI VPR "Vertical Position Relative" "CSI Ps e" "Move cursor `Ps` times down (default=1)."
*/ */
public vPositionRelative(params: IParams): void { public vPositionRelative(params: IParams): void {
this._moveCursor(0, params.params[0] || 1); this._moveCursor(0, params.params[0] || 1);
@@ -942,6 +857,8 @@ export class InputHandler extends Disposable implements IInputHandler {
* Horizontal and Vertical Position [row;column] (default = * Horizontal and Vertical Position [row;column] (default =
* [1,1]) (HVP). * [1,1]) (HVP).
* Same as CUP. * Same as CUP.
*
* @vt: supported CSI HVP "Horizontal and Vertical Position" "CSI Ps ; Ps f" "Same as CUP."
*/ */
public hVPosition(params: IParams): void { public hVPosition(params: IParams): void {
this.cursorPosition(params); this.cursorPosition(params);
@@ -954,6 +871,8 @@ export class InputHandler extends Disposable implements IInputHandler {
* Potentially: * Potentially:
* Ps = 2 -> Clear Stops on Line. * Ps = 2 -> Clear Stops on Line.
* http://vt100.net/annarbor/aaa-ug/section6.html * http://vt100.net/annarbor/aaa-ug/section6.html
*
* @vt: supported CSI TBC "Tab Clear" "CSI Ps g" "Clear tab stops at current position (0) or all (3) (default=0)."
*/ */
public tabClear(params: IParams): void { public tabClear(params: IParams): void {
const param = params.params[0]; const param = params.params[0];
@@ -967,6 +886,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI Ps I * CSI Ps I
* Cursor Forward Tabulation Ps tab stops (default = 1) (CHT). * Cursor Forward Tabulation Ps tab stops (default = 1) (CHT).
*
* @vt: supported CSI CHT "Cursor Horizontal Tabulation" "CSI Ps I" "Move cursor `Ps` times tabs forward (default=1)."
*/ */
public cursorForwardTab(params: IParams): void { public cursorForwardTab(params: IParams): void {
if (this._bufferService.buffer.x >= this._bufferService.cols) { if (this._bufferService.buffer.x >= this._bufferService.cols) {
@@ -980,6 +901,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT). * CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).
*
* @vt: supported CSI CBT "Cursor Backward Tabulation" "CSI Ps Z" "Move cursor `Ps` tabs backward (default=1)."
*/ */
public cursorBackwardTab(params: IParams): void { public cursorBackwardTab(params: IParams): void {
if (this._bufferService.buffer.x >= this._bufferService.cols) { if (this._bufferService.buffer.x >= this._bufferService.cols) {
@@ -1038,7 +961,11 @@ export class InputHandler extends Disposable implements IInputHandler {
* Ps = 0 -> Selective Erase Below (default). * Ps = 0 -> Selective Erase Below (default).
* Ps = 1 -> Selective Erase Above. * Ps = 1 -> Selective Erase Above.
* Ps = 2 -> Selective Erase All. * Ps = 2 -> Selective Erase All.
*
* @vt: supported CSI ED "Erase In Display" "CSI Ps J" "Erase various parts of the viewport."
* TODO: document different modes...
*/ */
// @vt: partly CSI DECSED "Selective Erase In Display" "CSI ? Ps J" "Currently the same as ED."
public eraseInDisplay(params: IParams): void { public eraseInDisplay(params: IParams): void {
this._restrictCursor(); this._restrictCursor();
let j; let j;
@@ -1098,7 +1025,11 @@ export class InputHandler extends Disposable implements IInputHandler {
* Ps = 0 -> Selective Erase to Right (default). * Ps = 0 -> Selective Erase to Right (default).
* Ps = 1 -> Selective Erase to Left. * Ps = 1 -> Selective Erase to Left.
* Ps = 2 -> Selective Erase All. * Ps = 2 -> Selective Erase All.
*
* @vt: supported CSI EL "Erase In Line" "CSI Ps K" "Erase various parts of the active row."
* TODO: document different modes...
*/ */
// @vt: partly CSI DECSEL "Selective Erase In Line" "CSI ? Ps K" "Currently the same as EL."
public eraseInLine(params: IParams): void { public eraseInLine(params: IParams): void {
this._restrictCursor(); this._restrictCursor();
switch (params.params[0]) { switch (params.params[0]) {
@@ -1118,6 +1049,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI Ps L * CSI Ps L
* Insert Ps Line(s) (default = 1) (IL). * Insert Ps Line(s) (default = 1) (IL).
*
* @vt: supported CSI IL "Insert Line" "CSI Ps L" "Insert `Ps` blank lines at active row (default=1)."
*/ */
public insertLines(params: IParams): void { public insertLines(params: IParams): void {
this._restrictCursor(); this._restrictCursor();
@@ -1148,6 +1081,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI Ps M * CSI Ps M
* Delete Ps Line(s) (default = 1) (DL). * Delete Ps Line(s) (default = 1) (DL).
*
* @vt: supported CSI DL "Delete Line" "CSI Ps M" "Delete `Ps` lines at active row (default=1)."
*/ */
public deleteLines(params: IParams): void { public deleteLines(params: IParams): void {
this._restrictCursor(); this._restrictCursor();
@@ -1197,6 +1132,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI Ps P * CSI Ps P
* Delete Ps Character(s) (default = 1) (DCH). * Delete Ps Character(s) (default = 1) (DCH).
*
* @vt: supported CSI DCH "Delete Character" "CSI Ps P" "Delete `Ps` characters in the active row (default=1)."
*/ */
public deleteChars(params: IParams): void { public deleteChars(params: IParams): void {
this._restrictCursor(); this._restrictCursor();
@@ -1214,6 +1151,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI Ps S Scroll up Ps lines (default = 1) (SU). * CSI Ps S Scroll up Ps lines (default = 1) (SU).
*
* @vt: supported CSI SU "Scroll Up" "CSI Ps S" "Scroll `Ps` lines up (default=1)."
*/ */
public scrollUp(params: IParams): void { public scrollUp(params: IParams): void {
let param = params.params[0] || 1; let param = params.params[0] || 1;
@@ -1230,6 +1169,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI Ps T Scroll down Ps lines (default = 1) (SD). * CSI Ps T Scroll down Ps lines (default = 1) (SD).
*
* @vt: supported CSI SD "Scroll Down" "CSI Ps T" "Scroll `Ps` lines down (default=1)."
*/ */
public scrollDown(params: IParams): void { public scrollDown(params: IParams): void {
let param = params.params[0] || 1; let param = params.params[0] || 1;
@@ -1257,6 +1198,8 @@ export class InputHandler extends Disposable implements IInputHandler {
* *
* Supported: * Supported:
* - always left shift (no line orientation setting respected) * - always left shift (no line orientation setting respected)
*
* @vt: supported CSI SL "Scroll Left" "CSI Ps SP @" "Scroll viewport `Ps` times to the left."
*/ */
public scrollLeft(params: IParams): void { public scrollLeft(params: IParams): void {
const buffer = this._bufferService.buffer; const buffer = this._bufferService.buffer;
@@ -1285,6 +1228,8 @@ export class InputHandler extends Disposable implements IInputHandler {
* *
* Supported: * Supported:
* - always right shift (no line orientation setting respected) * - always right shift (no line orientation setting respected)
*
* @vt: supported CSI SR "Scroll Right" "CSI Ps SP A" "Scroll viewport `Ps` times to the right."
*/ */
public scrollRight(params: IParams): void { public scrollRight(params: IParams): void {
const buffer = this._bufferService.buffer; const buffer = this._bufferService.buffer;
@@ -1303,6 +1248,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI Pm ' } * CSI Pm ' }
* Insert Ps Column(s) (default = 1) (DECIC), VT420 and up. * Insert Ps Column(s) (default = 1) (DECIC), VT420 and up.
*
* @vt: supported CSI DECIC "Insert Columns" "CSI Ps ' }" "Insert `Ps` columns at cursor position."
*/ */
public insertColumns(params: IParams): void { public insertColumns(params: IParams): void {
const buffer = this._bufferService.buffer; const buffer = this._bufferService.buffer;
@@ -1321,6 +1268,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI Pm ' ~ * CSI Pm ' ~
* Delete Ps Column(s) (default = 1) (DECDC), VT420 and up. * Delete Ps Column(s) (default = 1) (DECDC), VT420 and up.
*
* @vt: supported CSI DECDC "Delete Columns" "CSI Ps ' ~" "Delete `Ps` columns at cursor position."
*/ */
public deleteColumns(params: IParams): void { public deleteColumns(params: IParams): void {
const buffer = this._bufferService.buffer; const buffer = this._bufferService.buffer;
@@ -1339,6 +1288,8 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI Ps X * CSI Ps X
* Erase Ps Character(s) (default = 1) (ECH). * Erase Ps Character(s) (default = 1) (ECH).
*
* @vt: supported CSI ECH "Erase Character" "CSI Ps X" "Erase `Ps` characters from current cursor position to hte right (default=1)."
*/ */
public eraseChars(params: IParams): void { public eraseChars(params: IParams): void {
this._restrictCursor(); this._restrictCursor();
@@ -1375,6 +1326,10 @@ export class InputHandler extends Disposable implements IInputHandler {
* *
* Note: To get reset on a valid sequence working correctly without much runtime penalty, * Note: To get reset on a valid sequence working correctly without much runtime penalty,
* the preceding codepoint is stored on the parser in `this.print` and reset during `parser.parse`. * the preceding codepoint is stored on the parser in `this.print` and reset during `parser.parse`.
*
* @vt: supported CSI REP "Repeat Preceding Character" "CSI Ps b" "Repeat preceding character `Ps` times (default=1)."
* Has no effect if the sequence does not follow a printed character (NOOP for any other sequence in between).
* TODO: document character limitations due to xterm compliance
*/ */
public repeatPrecedingCharacter(params: IParams): void { public repeatPrecedingCharacter(params: IParams): void {
if (!this._parser.precedingCodepoint) { if (!this._parser.precedingCodepoint) {
@@ -1425,6 +1380,9 @@ export class InputHandler extends Disposable implements IInputHandler {
* More information: * More information:
* xterm/charproc.c - line 2012, for more information. * xterm/charproc.c - line 2012, for more information.
* vim responds with ^[[?0c or ^[[?1c after the terminal's response (?) * vim responds with ^[[?0c or ^[[?1c after the terminal's response (?)
*
* @vt: supported CSI DA1 "Primary Device Attributes" "CSI c" "Send primary device attributes."
* TODO: Describe response...
*/ */
public sendDeviceAttributesPrimary(params: IParams): void { public sendDeviceAttributesPrimary(params: IParams): void {
if (params.params[0] > 0) { if (params.params[0] > 0) {
@@ -1436,6 +1394,10 @@ export class InputHandler extends Disposable implements IInputHandler {
this._coreService.triggerDataEvent(C0.ESC + '[?6c'); this._coreService.triggerDataEvent(C0.ESC + '[?6c');
} }
} }
/**
* @vt: supported CSI DA2 "Secondary Device Attributes" "CSI > c" "Send primary device attributes."
* TODO: Describe response...
*/
public sendDeviceAttributesSecondary(params: IParams): void { public sendDeviceAttributesSecondary(params: IParams): void {
if (params.params[0] > 0) { if (params.params[0] > 0) {
return; return;
@@ -1541,6 +1503,9 @@ export class InputHandler extends Disposable implements IInputHandler {
* Ps = 2 0 0 4 -> Set bracketed paste mode. * Ps = 2 0 0 4 -> Set bracketed paste mode.
* Modes: * Modes:
* http: *vt100.net/docs/vt220-rm/chapter4.html * http: *vt100.net/docs/vt220-rm/chapter4.html
*
* @vt: partly CSI SM "Set Mode" "CSI Pm h" "Set various terminal attributes."
* TODO: Describe all supported attributes.
*/ */
public setMode(params: IParams): void { public setMode(params: IParams): void {
for (let i = 0; i < params.length; i++) { for (let i = 0; i < params.length; i++) {
@@ -1554,6 +1519,10 @@ export class InputHandler extends Disposable implements IInputHandler {
} }
} }
} }
/**
* @vt: partly CSI DECSET "DEC Private Set Mode" "CSI ? Pm h" "Set various terminal attributes."
* TODO: Describe all supported attributes.
*/
public setModePrivate(params: IParams): void { public setModePrivate(params: IParams): void {
for (let i = 0; i < params.length; i++) { for (let i = 0; i < params.length; i++) {
switch (params.params[i]) { switch (params.params[i]) {
@@ -1723,6 +1692,9 @@ export class InputHandler extends Disposable implements IInputHandler {
* Ps = 1 0 6 0 -> Reset legacy keyboard emulation (X11R6). * Ps = 1 0 6 0 -> Reset legacy keyboard emulation (X11R6).
* Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC style. * Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC style.
* Ps = 2 0 0 4 -> Reset bracketed paste mode. * Ps = 2 0 0 4 -> Reset bracketed paste mode.
*
* @vt: partly CSI RM "Reset Mode" "CSI Pm l" "Set various terminal attributes."
* TODO: Describe all supported attributes.
*/ */
public resetMode(params: IParams): void { public resetMode(params: IParams): void {
for (let i = 0; i < params.length; i++) { for (let i = 0; i < params.length; i++) {
@@ -1736,6 +1708,10 @@ export class InputHandler extends Disposable implements IInputHandler {
} }
} }
} }
/**
* @vt: partly CSI DECRST "DEC Private Reset Mode" "CSI ? Pm l" "Reset various terminal attributes."
* TODO: Describe all supported attributes.
*/
public resetModePrivate(params: IParams): void { public resetModePrivate(params: IParams): void {
for (let i = 0; i < params.length; i++) { for (let i = 0; i < params.length; i++) {
switch (params.params[i]) { switch (params.params[i]) {
@@ -1947,6 +1923,9 @@ export class InputHandler extends Disposable implements IInputHandler {
* Ps. * Ps.
* Ps = 4 8 ; 5 ; Ps -> Set background color to the second * Ps = 4 8 ; 5 ; Ps -> Set background color to the second
* Ps. * Ps.
*
* @vt: partly CSI SGR "Select Graphic Rendition" "CSI Pm m" "Set/Reset various text attributes."
* Detailed description goes here...
*/ */
public charAttributes(params: IParams): void { public charAttributes(params: IParams): void {
// Optimize a single SGR0. // Optimize a single SGR0.
@@ -2068,6 +2047,8 @@ export class InputHandler extends Disposable implements IInputHandler {
* Ps = 5 3 -> Report Locator status as * Ps = 5 3 -> Report Locator status as
* CSI ? 5 3 n Locator available, if compiled-in, or * CSI ? 5 3 n Locator available, if compiled-in, or
* CSI ? 5 0 n No Locator, if not. * CSI ? 5 0 n No Locator, if not.
*
* @vt: supported CSI DSR "Device Status Report" "CSI Ps n" "Request cursor position (CPR) with `Ps` = 6."
*/ */
public deviceStatus(params: IParams): void { public deviceStatus(params: IParams): void {
switch (params.params[0]) { switch (params.params[0]) {
@@ -2084,6 +2065,7 @@ export class InputHandler extends Disposable implements IInputHandler {
} }
} }
// @vt: partly CSI DECDSR "DEC Device Status Report" "CSI ? Ps n" "Only CPR is supported (same as DSR)."
public deviceStatusPrivate(params: IParams): void { public deviceStatusPrivate(params: IParams): void {
// modern xterm doesnt seem to // modern xterm doesnt seem to
// respond to any of these except ?6, 6, and 5 // respond to any of these except ?6, 6, and 5
@@ -2116,6 +2098,12 @@ export class InputHandler extends Disposable implements IInputHandler {
/** /**
* CSI ! p Soft terminal reset (DECSTR). * CSI ! p Soft terminal reset (DECSTR).
* http://vt100.net/docs/vt220-rm/table4-10.html * http://vt100.net/docs/vt220-rm/table4-10.html
*
* @vt: supported CSI DECSTR "Soft Terminal Reset" "CSI ! p" "Reset several terminal attributes to initial state."
* There are two terminal reset sequences - RIS and DECSTR. While RIS performs almost a full terminal bootstrap,
* DECSTR only resets certain attributes. For most needs DECSTR should be sufficient.
* Attributes reset to default values:
* - TODO: list attributes here ...
*/ */
public softReset(params: IParams): void { public softReset(params: IParams): void {
this._coreService.isCursorHidden = false; this._coreService.isCursorHidden = false;
@@ -2138,6 +2126,15 @@ export class InputHandler extends Disposable implements IInputHandler {
* Ps = 4 -> steady underline. * Ps = 4 -> steady underline.
* Ps = 5 -> blinking bar (xterm). * Ps = 5 -> blinking bar (xterm).
* Ps = 6 -> steady bar (xterm). * Ps = 6 -> steady bar (xterm).
*
* @vt: supported CSI DECSCUSR "Set Cursor Style" "CSI Ps SP q" "Set cursor style."
* Supported cursor styles (TODO: add note about `options.cursorBlink`):
* - empty, 0 or 1: steady block
* - 2: blink block
* - 3: steady underline
* - 4: blink underline
* - 5: steady bar
* - 6: blink bar
*/ */
public setCursorStyle(params: IParams): void { public setCursorStyle(params: IParams): void {
const param = params.params[0] || 1; const param = params.params[0] || 1;
@@ -2163,6 +2160,9 @@ export class InputHandler extends Disposable implements IInputHandler {
* CSI Ps ; Ps r * CSI Ps ; Ps r
* Set Scrolling Region [top;bottom] (default = full size of win- * Set Scrolling Region [top;bottom] (default = full size of win-
* dow) (DECSTBM). * dow) (DECSTBM).
*
* @vt: supported CSI DECSTBM "Set Top and Bottom Margin" "CSI Ps ; Ps r" "Set top and bottom margins of the viewport [top;bottom] (default = viewport size)."
* TODO: document specialties like dependent cursor commands and scrolling...
*/ */
public setScrollRegion(params: IParams): void { public setScrollRegion(params: IParams): void {
const top = params.params[0] || 1; const top = params.params[0] || 1;
@@ -2184,7 +2184,10 @@ export class InputHandler extends Disposable implements IInputHandler {
* CSI s * CSI s
* ESC 7 * ESC 7
* Save cursor (ANSI.SYS). * Save cursor (ANSI.SYS).
*
* @vt: partly CSI SCOSC "Save Cursor" "CSI s" "Save cursor position, charmap and text attributes."
*/ */
// @vt: supported ESC SC "Save Cursor" "ESC 7" "Save cursor position, charmap and text attributes."
public saveCursor(params?: IParams): void { public saveCursor(params?: IParams): void {
this._bufferService.buffer.savedX = this._bufferService.buffer.x; this._bufferService.buffer.savedX = this._bufferService.buffer.x;
this._bufferService.buffer.savedY = this._bufferService.buffer.ybase + this._bufferService.buffer.y; this._bufferService.buffer.savedY = this._bufferService.buffer.ybase + this._bufferService.buffer.y;
@@ -2198,7 +2201,10 @@ export class InputHandler extends Disposable implements IInputHandler {
* CSI u * CSI u
* ESC 8 * ESC 8
* Restore cursor (ANSI.SYS). * Restore cursor (ANSI.SYS).
*
* @vt: partly CSI SCORC "Restore Cursor" "CSI u" "Restore cursor position, charmap and text attributes."
*/ */
// @vt: supported ESC RC "Restore Cursor" "ESC 8" "Restore cursor position, charmap and text attributes."
public restoreCursor(params?: IParams): void { public restoreCursor(params?: IParams): void {
this._bufferService.buffer.x = this._bufferService.buffer.savedX || 0; this._bufferService.buffer.x = this._bufferService.buffer.savedX || 0;
this._bufferService.buffer.y = Math.max(this._bufferService.buffer.savedY - this._bufferService.buffer.ybase, 0); this._bufferService.buffer.y = Math.max(this._bufferService.buffer.savedY - this._bufferService.buffer.ybase, 0);
@@ -2216,6 +2222,13 @@ export class InputHandler extends Disposable implements IInputHandler {
* OSC 0; <data> ST (set icon name + window title) * OSC 0; <data> ST (set icon name + window title)
* OSC 2; <data> ST (set window title) * OSC 2; <data> ST (set window title)
* Proxy to set window title. Icon name is not supported. * Proxy to set window title. Icon name is not supported.
*
* @vt: partly OSC 0 "Set Windows Title and Icon Name" "OSC 0 ; Pt BEL" "Set window title and icon name."
* Icon name is not supported. For Window Title see below.
*/
/**
* @vt: supported OSC 2 "Set Windows Title" "OSC 2 ; Pt BEL" "Set window title."
* xterm.js does not manipulate the title directly, instead exposes changes via the event `Terminal.onTitleChange`.
*/ */
public setTitle(data: string): void { public setTitle(data: string): void {
this._terminal.handleTitle(data); this._terminal.handleTitle(data);
@@ -2226,7 +2239,10 @@ export class InputHandler extends Disposable implements IInputHandler {
* C1.NEL * C1.NEL
* DEC mnemonic: NEL (https://vt100.net/docs/vt510-rm/NEL) * DEC mnemonic: NEL (https://vt100.net/docs/vt510-rm/NEL)
* Moves cursor to first position on next line. * Moves cursor to first position on next line.
*
* @vt: supported C1 NEL "Next Line" "\x85" "Move the cursor to the beginning of the next row."
*/ */
// @vt: supported ESC NEL "Next Line" "ESC E" "Move the cursor to the beginning of the next row."
public nextLine(): void { public nextLine(): void {
this._bufferService.buffer.x = 0; this._bufferService.buffer.x = 0;
this.index(); this.index();
@@ -2298,7 +2314,10 @@ export class InputHandler extends Disposable implements IInputHandler {
* C1.IND * C1.IND
* DEC mnemonic: IND (https://vt100.net/docs/vt510-rm/IND.html) * DEC mnemonic: IND (https://vt100.net/docs/vt510-rm/IND.html)
* Moves the cursor down one line in the same column. * Moves the cursor down one line in the same column.
*
* @vt: supported C1 IND "Index" "\x84" "Move the cursor one line down scrolling if needed."
*/ */
// @vt: supported ESC IND "Index" "ESC D" "Move the cursor one line down scrolling if needed."
public index(): void { public index(): void {
this._restrictCursor(); this._restrictCursor();
const buffer = this._bufferService.buffer; const buffer = this._bufferService.buffer;
@@ -2318,7 +2337,10 @@ export class InputHandler extends Disposable implements IInputHandler {
* DEC mnemonic: HTS (https://vt100.net/docs/vt510-rm/HTS.html) * DEC mnemonic: HTS (https://vt100.net/docs/vt510-rm/HTS.html)
* Sets a horizontal tab stop at the column position indicated by * Sets a horizontal tab stop at the column position indicated by
* the value of the active column when the terminal receives an HTS. * the value of the active column when the terminal receives an HTS.
*
* @vt: supported C1 HTS "Horizontal Tabulation Set" "\x88" "Places a tab stop at the current cursor position."
*/ */
// @vt: supported ESC HTS "Horizontal Tabulation Set" "ESC H" "Places a tab stop at the current cursor position."
public tabSet(): void { public tabSet(): void {
this._bufferService.buffer.tabs[this._bufferService.buffer.x] = true; this._bufferService.buffer.tabs[this._bufferService.buffer.x] = true;
} }
@@ -2391,7 +2413,7 @@ export class InputHandler extends Disposable implements IInputHandler {
* This control function fills the complete screen area with * This control function fills the complete screen area with
* a test pattern (E) used for adjusting screen alignment. * a test pattern (E) used for adjusting screen alignment.
* *
* TODO: move DECALN into compat addon * @vt: supported ESC DECALN "Screen Alignment Pattern" "ESC # 8" "Fill viewport with a test pattern (E)."
*/ */
public screenAlignmentPattern(): void { public screenAlignmentPattern(): void {
// prepare cell data // prepare cell data