From 2de22f93568ba143898313625923dd2177b9eab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Sun, 18 Aug 2019 17:36:06 +0200 Subject: [PATCH 01/21] extract @vt entries from docs --- bin/extract_vtfeatures.js | 181 ++++++++++++++++++++++++++++++++++++++ package.json | 4 +- src/InputHandler.ts | 14 +++ yarn.lock | 5 ++ 4 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 bin/extract_vtfeatures.js diff --git a/bin/extract_vtfeatures.js b/bin/extract_vtfeatures.js new file mode 100644 index 00000000..60f3200e --- /dev/null +++ b/bin/extract_vtfeatures.js @@ -0,0 +1,181 @@ +/** + * Copyright (c) 2019 The xterm.js authors. All rights reserved. + * @license MIT + * + * Script to extract vt features documented in docstrings. + */ +const fs = require('fs'); +const Mustache = require('mustache'); + +/** + * regexp to fetch all comments + * Fetches all multiline comments and single lines containing '// @vt:'. + */ +const REX_COMMENTS = /^\s*?[/][*][*]([\s\S]*?)[*][/]|^\s*?\/\/ ([@]vt[:].*?)$/mug; + +// expected - "@vt: type name "sequence" "short description" +/** + * regexp to parse the @vt line + * expected data - "@vt: <"name"> "" "" + */ +const REX_VT_LINE = /^[@]vt\:\s*(\w+)\s*(\w+)\s*(\w+)\s*"(.*?)"\s*"(.*?)"\s*"(.*?)".*$/; + +// known vt command types +const TYPES = [ + 'C0', + 'C1', + 'ESC', + 'CSI', + 'DCS', + 'OSC', + 'APC', + 'PM', + 'SOS' +]; + +const MARKDOWN_TMPL = ` +# Supported VT features by xterm.js +Version: {{version}} +### C0 + +| Mnemonic | Name | Sequence | Short Description | Status | +| -------- | ---- | -------- | ----------------- | ------ | +{{#C0}} +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | +{{/C0}} + + +### C1 + +| Mnemonic | Name | Sequence | Short Description | Status | +| -------- | ---- | -------- | ----------------- | ------ | +{{#C1}} +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | +{{/C1}} + + +### CSI + +| Mnemonic | Name | Sequence | Short Description | Status | +| -------- | ---- | -------- | ----------------- | ------ | +{{#CSI}} +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | +{{/CSI}} + + +### DCS + +| Mnemonic | Name | Sequence | Short Description | Status | +| -------- | ---- | -------- | ----------------- | ------ | +{{#DCS}} +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | +{{/DCS}} + + +### ESC + +| Mnemonic | Name | Sequence | Short Description | Status | +| -------- | ---- | -------- | ----------------- | ------ | +{{#ESC}} +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | +{{/ESC}} + + +### OSC + +| Mnemonic | Name | Sequence | Short Description | Status | +| -------- | ---- | -------- | ----------------- | ------ | +{{#OSC}} +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | +{{/OSC}} +` + +function parseMultiLine(filename, s) { + if (!~s.indexOf('@vt:')) { + return; + } + const lines = s.split('\n').map(el => el.trim().replace(/[*]/, '').replace(/\s/, '')); + let grabLine = false; + const longDescription = []; + let feature; + for (const line of lines) { + if (grabLine) { + if (!line) { + break; + } + longDescription.push(line); + } + if (~line.indexOf('@vt:')) { + feature = parseSingleLine(filename, line); + grabLine = true; + } + } + if (feature) { + feature.longDescription = longDescription; + return feature; + } +} + +function parseSingleLine(filename, s) { + const line = s.trim(); + const match = line.match(REX_VT_LINE); + if (match !== null) { + if (!~TYPES.indexOf(match[2])) { + throw new Error(`unkown vt-command type "${match[2]}" specified in "${filename}"`); + } + return { + status: match[1], + type: match[2], + mnemonic: match[3], + name: match[4], + sequence: match[5], + shortDescription: match[6], + longDescription: [], + source: filename + }; + } +} + +function postProcessData(features) { + const featureTable = {}; + for (const feature of features) { + if (featureTable[feature.type] === undefined) { + featureTable[feature.type] = []; + } + featureTable[feature.type].push(feature); + } + for (const entry in featureTable) { + featureTable[entry].sort((a, b) => a.sequence.slice(-1) > b.sequence.slice(-1)); + } + // console.error(featureTable); + featureTable.version = require('../package.json').version; + console.log(Mustache.render(MARKDOWN_TMPL, featureTable)); +} + +function main(filenames) { + // console.error(filenames); + let leftToProcess = filenames.length; + const features = []; + for (const filename of filenames) { + fs.readFile(filename, 'utf-8', (err, data) => { + let match; + while ((match = REX_COMMENTS.exec(data)) !== null) { + if (match.index === REX_COMMENTS.lastIndex) { + REX_COMMENTS.lastIndex++; + } + const feature = match[1] + ? parseMultiLine(filename, match[1]) + : parseSingleLine(filename, match[2]); + if (feature) { + features.push(feature); + } + } + leftToProcess--; + if (!leftToProcess) { + postProcessData(features); + } + }); + } +} + +main(process.argv.slice(2)) diff --git a/package.json b/package.json index 68467a89..5c5bd789 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ "benchmark": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json", "benchmark-baseline": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --baseline out-test/benchmark/test/benchmark/*benchmark.js", "benchmark-eval": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --eval out-test/benchmark/test/benchmark/*benchmark.js", - "clean": "rm -rf lib out addons/*/lib addons/*/out" + "clean": "rm -rf lib out addons/*/lib addons/*/out", + "vtfeatures": "node bin/extract_vt.js src/**/*.ts src/*.ts" }, "devDependencies": { "@types/chai": "^3.4.34", @@ -41,6 +42,7 @@ "glob": "^7.0.5", "jsdom": "^11.11.0", "mocha": "^6.1.4", + "mustache": "^3.0.1", "node-pty": "0.7.6", "puppeteer": "^1.15.0", "source-map-loader": "^0.2.4", diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 90067772..9b550585 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -177,13 +177,18 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI handler */ this._parser.setCsiHandler({final: '@'}, params => this.insertChars(params)); + // @vt: supported CSI CUU "Cursor Up" "CSI Ps A" "Move the cursor position `Ps` times to the top (default=1)." this._parser.setCsiHandler({final: 'A'}, params => this.cursorUp(params)); + // @vt: supported CSI CUD "Cursor Down" "CSI Ps B" "Move the cursor position `Ps` times to the bottom (default=1)." this._parser.setCsiHandler({final: 'B'}, params => this.cursorDown(params)); + // @vt: supported CSI CUF "Cursor Forward" "CSI Ps C" "Move the cursor position `Ps` times to the right (default=1)." this._parser.setCsiHandler({final: 'C'}, params => this.cursorForward(params)); + // @vt: supported CSI CUB "Cursor Backward" "CSI Ps D" "Move the cursor position `Ps` times to the left (default=1)." this._parser.setCsiHandler({final: 'D'}, params => this.cursorBackward(params)); this._parser.setCsiHandler({final: 'E'}, params => this.cursorNextLine(params)); this._parser.setCsiHandler({final: 'F'}, params => this.cursorPrecedingLine(params)); this._parser.setCsiHandler({final: 'G'}, params => this.cursorCharAbsolute(params)); + // @vt: supported CSI CUP "Cursor Position" "CSI Ps ; Ps H" "Set the cursor to position [`Ps`, `Ps`]." this._parser.setCsiHandler({final: 'H'}, params => this.cursorPosition(params)); this._parser.setCsiHandler({final: 'I'}, params => this.cursorForwardTab(params)); this._parser.setCsiHandler({final: 'J'}, params => this.eraseInDisplay(params)); @@ -210,6 +215,7 @@ export class InputHandler extends Disposable implements IInputHandler { this._parser.setCsiHandler({prefix: '?', final: 'h'}, params => this.setModePrivate(params)); this._parser.setCsiHandler({final: 'l'}, params => this.resetMode(params)); this._parser.setCsiHandler({prefix: '?', final: 'l'}, params => this.resetModePrivate(params)); + // @vt: partly CSI SGR "Select Graphic Rendition" "CSI Pm m" "Set various text attributes." this._parser.setCsiHandler({final: 'm'}, params => this.charAttributes(params)); this._parser.setCsiHandler({final: 'n'}, params => this.deviceStatus(params)); this._parser.setCsiHandler({prefix: '?', final: 'n'}, params => this.deviceStatusPrivate(params)); @@ -222,11 +228,15 @@ export class InputHandler extends Disposable implements IInputHandler { /** * execute handler */ + // @vt: supported C0 BEL "Bell" "\x07" "Rings the bell." this._parser.setExecuteHandler(C0.BEL, () => this.bell()); + // @vt: supported C0 LF "Line Feed" "\n" "Moves the cursor one row down, scrolling if needed." this._parser.setExecuteHandler(C0.LF, () => this.lineFeed()); this._parser.setExecuteHandler(C0.VT, () => this.lineFeed()); this._parser.setExecuteHandler(C0.FF, () => this.lineFeed()); + // @vt: supported C0 CR "Carriage Return" "\r" "Moves the cursor to the beginning of the row." this._parser.setExecuteHandler(C0.CR, () => this.carriageReturn()); + // @vt: supported C0 BS "Backspace" "\x08" "Moves the cursor one position to the left." this._parser.setExecuteHandler(C0.BS, () => this.backspace()); this._parser.setExecuteHandler(C0.HT, () => this.tab()); this._parser.setExecuteHandler(C0.SO, () => this.shiftOut()); @@ -241,9 +251,12 @@ export class InputHandler extends Disposable implements IInputHandler { * OSC handler */ // 0 - icon name + title + // @vt: partly OSC OSC0 "" "OSC 0 ; Pt BEL" "Set window title and icon name." this._parser.setOscHandler(0, new OscHandler((data: string) => this.setTitle(data))); // 1 - icon name + // @vt: unsupported OSC OSC1 "" "OSC 1 ; Pt BEL" "Set icon name." // 2 - title + // @vt: supported OSC OSC2 "" "OSC 2 ; Pt BEL" "Set window title." this._parser.setOscHandler(2, new OscHandler((data: string) => this.setTitle(data))); // 3 - set property X in the form "prop=value" // 4 - Change Color Number @@ -306,6 +319,7 @@ 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)); // 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()); /** diff --git a/yarn.lock b/yarn.lock index a67ede71..42ecc4cb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3133,6 +3133,11 @@ ms@2.1.1, ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== +mustache@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/mustache/-/mustache-3.0.1.tgz#873855f23aa8a95b150fb96d9836edbc5a1d248a" + integrity sha512-jFI/4UVRsRYdUbuDTKT7KzfOp7FiD5WzYmmwNwXyUVypC0xjoTL78Fqc0jHUPIvvGD+6DQSPHIt1NE7D1ArsqA== + mute-stream@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" From 9cd80a2c6b925e80e54fd05de0a17f577f274042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Sun, 18 Aug 2019 17:52:26 +0200 Subject: [PATCH 02/21] cleanup --- bin/extract_vtfeatures.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/extract_vtfeatures.js b/bin/extract_vtfeatures.js index 60f3200e..fdc7e4bf 100644 --- a/bin/extract_vtfeatures.js +++ b/bin/extract_vtfeatures.js @@ -13,10 +13,9 @@ const Mustache = require('mustache'); */ const REX_COMMENTS = /^\s*?[/][*][*]([\s\S]*?)[*][/]|^\s*?\/\/ ([@]vt[:].*?)$/mug; -// expected - "@vt: type name "sequence" "short description" /** * regexp to parse the @vt line - * expected data - "@vt: <"name"> "" "" + * expected data - "@vt: "" "" "" */ const REX_VT_LINE = /^[@]vt\:\s*(\w+)\s*(\w+)\s*(\w+)\s*"(.*?)"\s*"(.*?)"\s*"(.*?)".*$/; From f34edc311663e1083487a4158b3d6acb26ea1f91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Sun, 18 Aug 2019 17:57:22 +0200 Subject: [PATCH 03/21] rename script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5c5bd789..25dd9c88 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "benchmark-baseline": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --baseline out-test/benchmark/test/benchmark/*benchmark.js", "benchmark-eval": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --eval out-test/benchmark/test/benchmark/*benchmark.js", "clean": "rm -rf lib out addons/*/lib addons/*/out", - "vtfeatures": "node bin/extract_vt.js src/**/*.ts src/*.ts" + "vtfeatures": "node bin/extract_vtfeatures.js src/**/*.ts src/*.ts" }, "devDependencies": { "@types/chai": "^3.4.34", From 66709e6f22e5d1a42062a92214cca777f86ccfb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Sun, 18 Aug 2019 21:50:17 +0200 Subject: [PATCH 04/21] fix OSC list header; general notes --- bin/extract_vtfeatures.js | 75 ++++++++++++++++++++++++++++++++++----- src/InputHandler.ts | 6 ++-- 2 files changed, 70 insertions(+), 11 deletions(-) diff --git a/bin/extract_vtfeatures.js b/bin/extract_vtfeatures.js index fdc7e4bf..ebebbf06 100644 --- a/bin/extract_vtfeatures.js +++ b/bin/extract_vtfeatures.js @@ -35,6 +35,55 @@ const TYPES = [ const MARKDOWN_TMPL = ` # Supported VT features by xterm.js Version: {{version}} + +### Table of Contents + +- [General notes](#general-notes) +{{#C0.length}} +- [C0](#c0) +{{/C0.length}} +{{#C1.length}} +- [C1](#c1) +{{/C1.length}} +{{#CSI.length}} +- [CSI](#csi) +{{/CSI.length}} +{{#DCS.length}} +- [DCS](#dcs) +{{/DCS.length}} +{{#ESC.length}} +- [ESC](#esc) +{{/ESC.length}} +{{#OSC.length}} +- [OSC](#osc) +{{/OSC.length}} + +### General notes + +This document lists xterm.js' support of typical VT commands. The commands are grouped by their type: + +- C0: single byte command (7bit control characters, byte range \\x00 .. \\x1f) +- C1: single byte command (8bit control characters, byte range \\x80 .. \\x9f) +- ESC: sequence starting with \`ESC\` (\`\\x1b\`) +- CSI - Control Sequence Introducer: sequence starting with \`ESC [\` (7bit) or CSI (\`\\x9b\` 8bit) +- DCS - Device Control String: sequence starting with \`ESC P\` (7bit) or DCS (\`\\x90\` 8bit) +- OSC - Operating System Command: sequence starting with \`ESC ]\` (7bit) or OSC (\`\\x9d\` 8bit) + +Application Program Command (APC), Privacy Message (PM) and Start of String (SOS) are not supported, +any sequence of these types will be ignored. + +Note that the list only contains commands implemented in xterm.js' core codebase. Missing commands are either +not supported or unstable/experimental. Furthermore addons can provide additional commands. + +To denote the sequences the lists use the same abbreviations as xterm does: +- \`Ps\`: A single (usually optional) numeric parameter, composed of one or more decimal digits. +- \`Pm\`: A multiple numeric parameter composed of any number of single numeric parameters, separated by ; character(s), + e.g. \` Ps ; Ps ; ... \`. +- \`Pt\`: A text parameter composed of printable characters. Note that for most commands with \`Pt\` only + ASCII printables are specified to work. Additionally xterm.js will let any character >C1 pass as printable. + + +{{#C0.length}} ### C0 | Mnemonic | Name | Sequence | Short Description | Status | @@ -42,8 +91,9 @@ Version: {{version}} {{#C0}} | {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | {{/C0}} +{{/C0.length}} - +{{#C1.length}} ### C1 | Mnemonic | Name | Sequence | Short Description | Status | @@ -51,8 +101,9 @@ Version: {{version}} {{#C1}} | {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | {{/C1}} +{{/C1.length}} - +{{#CSI.length}} ### CSI | Mnemonic | Name | Sequence | Short Description | Status | @@ -60,8 +111,9 @@ Version: {{version}} {{#CSI}} | {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | {{/CSI}} +{{/CSI.length}} - +{{#DCS.length}} ### DCS | Mnemonic | Name | Sequence | Short Description | Status | @@ -69,8 +121,9 @@ Version: {{version}} {{#DCS}} | {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | {{/DCS}} +{{/DCS.length}} - +{{#ESC.length}} ### ESC | Mnemonic | Name | Sequence | Short Description | Status | @@ -78,15 +131,21 @@ Version: {{version}} {{#ESC}} | {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | {{/ESC}} +{{/ESC.length}} - +{{#OSC.length}} ### OSC -| Mnemonic | Name | Sequence | Short Description | Status | -| -------- | ---- | -------- | ----------------- | ------ | +| Identifier | Sequence | Short Description | Status | +| ---------- | -------- | ----------------- | ------ | {{#OSC}} -| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | +| {{mnemonic}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | {{/OSC}} +{{/OSC.length}} + +### TODO +- specific notes on several commands (long description) +- references ` function parseMultiLine(filename, s) { diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 9b550585..90107e24 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -251,12 +251,12 @@ export class InputHandler extends Disposable implements IInputHandler { * OSC handler */ // 0 - icon name + title - // @vt: partly OSC OSC0 "" "OSC 0 ; Pt BEL" "Set window title and icon name." + // @vt: partly OSC 0 "" "OSC 0 ; Pt BEL" "Set window title and icon name." this._parser.setOscHandler(0, new OscHandler((data: string) => this.setTitle(data))); // 1 - icon name - // @vt: unsupported OSC OSC1 "" "OSC 1 ; Pt BEL" "Set icon name." + // @vt: unsupported OSC 1 "" "OSC 1 ; Pt BEL" "Set icon name." // 2 - title - // @vt: supported OSC OSC2 "" "OSC 2 ; Pt BEL" "Set window title." + // @vt: supported OSC 2 "" "OSC 2 ; Pt BEL" "Set window title." this._parser.setOscHandler(2, new OscHandler((data: string) => this.setTitle(data))); // 3 - set property X in the form "prop=value" // 4 - Change Color Number From 8b2d85c82359c7240cc77186cd91be50fca316f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Mon, 19 Aug 2019 22:54:55 +0200 Subject: [PATCH 05/21] document more commands; long description hook --- bin/extract_vtfeatures.js | 104 ++++++++++++++++++++++++-- src/InputHandler.ts | 152 ++++++++++++++++++++++++++++++++++---- 2 files changed, 236 insertions(+), 20 deletions(-) diff --git a/bin/extract_vtfeatures.js b/bin/extract_vtfeatures.js index ebebbf06..2122e19a 100644 --- a/bin/extract_vtfeatures.js +++ b/bin/extract_vtfeatures.js @@ -89,65 +89,150 @@ To denote the sequences the lists use the same abbreviations as xterm does: | Mnemonic | Name | Sequence | Short Description | Status | | -------- | ---- | -------- | ----------------- | ------ | {{#C0}} -| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{status}} | {{/C0}} + +{{#C0.hasLongDescriptions}} +{{#C0}} +{{#longDescription.length}} +#### {{name}} +{{#longDescription}} +{{{.}}} +{{/longDescription}} +{{/longDescription.length}} +{{/C0}} +{{/C0.hasLongDescriptions}} + {{/C0.length}} + {{#C1.length}} ### C1 | Mnemonic | Name | Sequence | Short Description | Status | | -------- | ---- | -------- | ----------------- | ------ | {{#C1}} -| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{status}} | {{/C1}} + +{{#C1.hasLongDescriptions}} +{{#C1}} +{{#longDescription.length}} +#### {{name}} +{{#longDescription}} +{{{.}}} +{{/longDescription}} +{{/longDescription.length}} +{{/C1}} +{{/C1.hasLongDescriptions}} + {{/C1.length}} + {{#CSI.length}} ### CSI | Mnemonic | Name | Sequence | Short Description | Status | | -------- | ---- | -------- | ----------------- | ------ | {{#CSI}} -| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{status}} | {{/CSI}} + +{{#CSI.hasLongDescriptions}} +{{#CSI}} +{{#longDescription.length}} +#### {{name}} +{{#longDescription}} +{{{.}}} +{{/longDescription}} +{{/longDescription.length}} +{{/CSI}} +{{/CSI.hasLongDescriptions}} + {{/CSI.length}} + {{#DCS.length}} ### DCS | Mnemonic | Name | Sequence | Short Description | Status | | -------- | ---- | -------- | ----------------- | ------ | {{#DCS}} -| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{status}} | {{/DCS}} + +{{#DCS.hasLongDescriptions}} +{{#DCS}} +{{#longDescription.length}} +#### {{name}} +{{#longDescription}} +{{{.}}} +{{/longDescription}} +{{/longDescription.length}} +{{/DCS}} +{{/DCS.hasLongDescriptions}} + {{/DCS.length}} + {{#ESC.length}} ### ESC | Mnemonic | Name | Sequence | Short Description | Status | | -------- | ---- | -------- | ----------------- | ------ | {{#ESC}} -| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{status}} | {{/ESC}} + +{{#ESC.hasLongDescriptions}} +{{#ESC}} +{{#longDescription.length}} +#### {{name}} +{{#longDescription}} +{{{.}}} +{{/longDescription}} +{{/longDescription.length}} +{{/ESC}} +{{/ESC.hasLongDescriptions}} + {{/ESC.length}} + {{#OSC.length}} ### OSC | Identifier | Sequence | Short Description | Status | | ---------- | -------- | ----------------- | ------ | {{#OSC}} -| {{mnemonic}} | \`{{sequence}}\` | {{shortDescription}} | {{status}} | +| {{mnemonic}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{status}} | {{/OSC}} + +{{#OSC.hasLongDescriptions}} +{{#OSC}} +{{#longDescription.length}} +#### {{name}} +{{#longDescription}} +{{{.}}} +{{/longDescription}} +{{/longDescription.length}} +{{/OSC}} +{{/OSC.hasLongDescriptions}} + {{/OSC.length}} + ### TODO -- specific notes on several commands (long description) +- improve table sorting: + - sort C0/C1 in byte order + - sort OSC in numerical order + - sort CSI/ESC/DCS in final byte order - references ` +function createAnchorSlug(s) { + return s.toLowerCase().split(' ').join('-'); +} + function parseMultiLine(filename, s) { if (!~s.indexOf('@vt:')) { return; @@ -170,6 +255,7 @@ function parseMultiLine(filename, s) { } if (feature) { feature.longDescription = longDescription; + feature.longTarget = createAnchorSlug(feature.name); return feature; } } @@ -189,6 +275,7 @@ function parseSingleLine(filename, s) { sequence: match[5], shortDescription: match[6], longDescription: [], + longTarget: '', source: filename }; } @@ -201,6 +288,9 @@ function postProcessData(features) { featureTable[feature.type] = []; } featureTable[feature.type].push(feature); + if (feature.longDescription) { + featureTable[feature.type].hasLongDescriptions = true; + } } for (const entry in featureTable) { featureTable[entry].sort((a, b) => a.sequence.slice(-1) > b.sequence.slice(-1)); diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 90107e24..c9a8e893 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -29,6 +29,14 @@ import { DcsHandler } from 'common/parser/DcsParser'; */ const GLEVEL: {[key: string]: number} = {'(': 0, ')': 1, '*': 2, '+': 3, '-': 1, '.': 2}; +/** + * 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 CSI SL "Scroll Left" "CSI Ps SP @" "Scroll viewport `Ps` times to the left." +// @vt: unsupported CSI SR "Scroll Right" "CSI Ps SP A" "Scroll viewport `Ps` times to the right." +// @vt: unsupported CSI DECIC "Insert Columns" "CSI Ps ' }" "Insert `Ps` columns at cursor position." +// @vt: unsupported CSI DECDC "Delete Columns" "CSI Ps ' ~" "Delete `Ps` columns at cursor position." /** * DCS subparser implementations @@ -39,6 +47,12 @@ const GLEVEL: {[key: string]: number} = {'(': 0, ')': 1, '*': 2, '+': 3, '-': 1, * DECRQSS (https://vt100.net/docs/vt510-rm/DECRQSS.html) * Request Status String (DECRQSS), VT420 and up. * Response: DECRPSS (https://vt100.net/docs/vt510-rm/DECRPSS.html) + * + * @vt: partly DCS DECRQSS "Request Selection or Setting" "DCS $ q Pt ST" "Request several the terminal settings." + * Supported: + * - Graphic Rendition (SGR): `DCS $ q m ST` (always reporting 0m) + * - Top and Bottom Margins (DECSTBM): `DCS $ q m ST` + * - Cursor Style (DECSCUSR): `DCS $ q SP q ST` */ class DECRQSS implements IDcsHandler { private _data: Uint32Array = new Uint32Array(0); @@ -177,86 +191,192 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI handler */ this._parser.setCsiHandler({final: '@'}, params => this.insertChars(params)); - // @vt: supported CSI CUU "Cursor Up" "CSI Ps A" "Move the cursor position `Ps` times to the top (default=1)." + // @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)); - // @vt: supported CSI CUD "Cursor Down" "CSI Ps B" "Move the cursor position `Ps` times to the bottom (default=1)." + // @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)); - // @vt: supported CSI CUF "Cursor Forward" "CSI Ps C" "Move the cursor position `Ps` times to the right (default=1)." + // @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)); - // @vt: supported CSI CUB "Cursor Backward" "CSI Ps D" "Move the cursor position `Ps` times to the left (default=1)." + // @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)); + // @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)); + // @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)); + // @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)); - // @vt: supported CSI CUP "Cursor Position" "CSI Ps ; Ps H" "Set the cursor to position [`Ps`, `Ps`]." + // @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)); + // @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)); + /** + * @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)); + // @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)); + /** + * @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)); + // @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)); + // @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)); + // @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)); + // @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)); + // @vt: supported CSI SU "Scroll Up" "CSI Ps S" "Scroll `Ps` lines up (default=1)." 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)); + // @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)); + //@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)); + // @vt: supported CSI HPA "Horizontal Position Absolute" "CSI Ps `" "Same as CHA." 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)); + /** + * @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)); + /** + * @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)); + /** + * @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)); + // @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)); + // @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)); + // @vt: supported CSI HVP "Horizontal and Vertical Position" "CSI Ps ; Ps f" "Same as CUP." 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)); + /** + * @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)); + /** + * @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)); + /** + * @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)); + /** + * @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)); - // @vt: partly CSI SGR "Select Graphic Rendition" "CSI Pm m" "Set various text attributes." + /** + * @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)); + // @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)); + // @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)); + /** + * @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)); + /** + * @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)); + /** + * @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)); + // @vt: partly CSI SCOSC "Save Cursor" "CSI s" "Save cursor position, charmap and text attributes." 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)); /** * execute handler */ - // @vt: supported C0 BEL "Bell" "\x07" "Rings the bell." + /** + * @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()); - // @vt: supported C0 LF "Line Feed" "\n" "Moves the cursor one row down, scrolling if needed." + // @vt: supported C0 LF "Line Feed" "\n" "Move the cursor one row down, scrolling if needed." this._parser.setExecuteHandler(C0.LF, () => this.lineFeed()); + // @vt: supported C0 VT "Vertical Tabulation" "\v" "Treated as LF." this._parser.setExecuteHandler(C0.VT, () => this.lineFeed()); + // @vt: supported C0 FF "Form Feed" "\f" "Treated as LF." this._parser.setExecuteHandler(C0.FF, () => this.lineFeed()); - // @vt: supported C0 CR "Carriage Return" "\r" "Moves the cursor to the beginning of the row." + // @vt: supported C0 CR "Carriage Return" "\r" "Move the cursor to the beginning of the row." this._parser.setExecuteHandler(C0.CR, () => this.carriageReturn()); - // @vt: supported C0 BS "Backspace" "\x08" "Moves the cursor one position to the left." + // @vt: supported C0 BS "Backspace" "\b" "Move the cursor one position to the left." 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()); + /** + * @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()); + // @vt: supported C0 SI "Shift In" "\x0f" "Return to regular character set after Shift Out." this._parser.setExecuteHandler(C0.SI, () => this.shiftIn()); // 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()); + // @vt: supported C1 NEL "Next Line" "\x85" "Move the cursor to the beginning of the next row." 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()); /** * OSC handler */ // 0 - icon name + title - // @vt: partly OSC 0 "" "OSC 0 ; Pt BEL" "Set window title and icon name." + /** + * @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))); // 1 - icon name - // @vt: unsupported OSC 1 "" "OSC 1 ; Pt BEL" "Set icon name." + // @vt: unsupported OSC 1 "Set Icon Name" "OSC 1 ; Pt BEL" "Set icon name." // 2 - title - // @vt: supported OSC 2 "" "OSC 2 ; Pt BEL" "Set window 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))); // 3 - set property X in the form "prop=value" // 4 - Change Color Number @@ -294,11 +414,17 @@ export class InputHandler extends Disposable implements IInputHandler { /** * ESC handlers */ + // @vt: supported ESC SC "Save Cursor" "ESC 7" "Save cursor position, charmap and text attributes." 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()); + // @vt: supported ESC IND "Index" "ESC D" "Move the cursor one line down scrolling if needed." 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()); + // @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()); + // @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: '='}, () => this.keypadApplicationMode()); this._parser.setEscHandler({final: '>'}, () => this.keypadNumericMode()); From aacc9c86b9a7c4d98ade70352fd669ac23852bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Mon, 19 Aug 2019 22:59:14 +0200 Subject: [PATCH 06/21] linter --- src/InputHandler.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/InputHandler.ts b/src/InputHandler.ts index c9a8e893..6c584b4e 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -47,7 +47,7 @@ const GLEVEL: {[key: string]: number} = {'(': 0, ')': 1, '*': 2, '+': 3, '-': 1, * DECRQSS (https://vt100.net/docs/vt510-rm/DECRQSS.html) * Request Status String (DECRQSS), VT420 and up. * Response: DECRPSS (https://vt100.net/docs/vt510-rm/DECRPSS.html) - * + * * @vt: partly DCS DECRQSS "Request Selection or Setting" "DCS $ q Pt ST" "Request several the terminal settings." * Supported: * - Graphic Rendition (SGR): `DCS $ q m ST` (always reporting 0m) @@ -235,7 +235,7 @@ export class InputHandler extends Disposable implements IInputHandler { 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)); - //@vt: supported CSI CBT "Cursor Backward Tabulation" "CSI Ps Z" "Move cursor `Ps` tabs backward (default=1)." + // @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)); // @vt: supported CSI HPA "Horizontal Position Absolute" "CSI Ps `" "Same as CHA." this._parser.setCsiHandler({final: '`'}, params => this.charPosAbsolute(params)); From a0d724c1864f83b0cc871b0ca660fa3a905eb382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Sun, 5 Jan 2020 22:41:36 +0100 Subject: [PATCH 07/21] move doc to impl --- src/InputHandler.ts | 284 ++++++++++++++++++++++++-------------------- 1 file changed, 153 insertions(+), 131 deletions(-) diff --git a/src/InputHandler.ts b/src/InputHandler.ts index c04f1113..5868f0dc 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -32,6 +32,7 @@ const GLEVEL: {[key: string]: number} = {'(': 0, ')': 1, '*': 2, '+': 3, '-': 1, * 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 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. @@ -201,200 +202,77 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI handler */ 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)); - // @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)); - // @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)); - // @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)); - // @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)); - // @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)); - // @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)); - // @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)); - // @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)); - // @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)); - // @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)); - /** - * @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)); - // @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)); - /** - * @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)); - // @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)); - // @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)); - // @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)); - // @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)); - // @vt: supported CSI SU "Scroll Up" "CSI Ps S" "Scroll `Ps` lines up (default=1)." 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)); - // @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)); - // @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)); - // @vt: supported CSI HPA "Horizontal Position Absolute" "CSI Ps `" "Same as CHA." 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)); - /** - * @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)); - /** - * @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)); - /** - * @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)); - // @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)); - // @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)); - // @vt: supported CSI HVP "Horizontal and Vertical Position" "CSI Ps ; Ps f" "Same as CUP." 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)); - /** - * @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)); - /** - * @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)); - /** - * @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)); - /** - * @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)); - /** - * @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)); - // @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)); - // @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)); - /** - * @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)); - /** - * @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)); - /** - * @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)); - // @vt: partly CSI SCOSC "Save Cursor" "CSI s" "Save cursor position, charmap and text attributes." 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)); - // @vt: supported CSI DECIC "Insert Columns" "CSI Ps ' }" "Insert `Ps` columns at cursor position." 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)); /** * 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()); - // @vt: supported C0 LF "Line Feed" "\n" "Move the cursor one row down, scrolling if needed." this._parser.setExecuteHandler(C0.LF, () => this.lineFeed()); - // @vt: supported C0 VT "Vertical Tabulation" "\v" "Treated as LF." this._parser.setExecuteHandler(C0.VT, () => this.lineFeed()); - // @vt: supported C0 FF "Form Feed" "\f" "Treated as LF." 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()); - // @vt: supported C0 BS "Backspace" "\b" "Move the cursor one position to the left." 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()); - /** - * @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()); - // @vt: supported C0 SI "Shift In" "\x0f" "Return to regular character set after Shift Out." this._parser.setExecuteHandler(C0.SI, () => this.shiftIn()); // 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()); - // @vt: supported C1 NEL "Next Line" "\x85" "Move the cursor to the beginning of the next row." 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()); /** * OSC handler */ // 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))); // 1 - icon name - // @vt: unsupported OSC 1 "Set Icon Name" "OSC 1 ; Pt BEL" "Set icon name." // 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))); // 3 - set property X in the form "prop=value" // 4 - Change Color Number @@ -432,15 +310,10 @@ export class InputHandler extends Disposable implements IInputHandler { /** * ESC handlers */ - // @vt: supported ESC SC "Save Cursor" "ESC 7" "Save cursor position, charmap and text attributes." 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()); - // @vt: supported ESC IND "Index" "ESC D" "Move the cursor one line down scrolling if needed." 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()); - // @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()); // @vt: supported ESC IR "Reverse Index" "ESC M" "Move the cursor one line up scrolling if needed." 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)); // 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()); /** @@ -696,6 +568,10 @@ export class InputHandler extends Disposable implements IInputHandler { /** * BEL * 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 { this._onRequestBell.fire(); @@ -704,7 +580,11 @@ export class InputHandler extends Disposable implements IInputHandler { /** * LF * 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 { // make buffer local for faster access const buffer = this._bufferService.buffer; @@ -732,6 +612,8 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CR * Carriage Return (Ctrl-M). + * + * @vt: supported C0 CR "Carriage Return" "\r" "Move the cursor to the beginning of the row." */ public carriageReturn(): void { this._bufferService.buffer.x = 0; @@ -740,6 +622,8 @@ export class InputHandler extends Disposable implements IInputHandler { /** * BS * Backspace (Ctrl-H). + * + * @vt: supported C0 BS "Backspace" "\b" "Move the cursor one position to the left." */ public backspace(): void { this._restrictCursor(); @@ -751,6 +635,8 @@ export class InputHandler extends Disposable implements IInputHandler { /** * TAB * Horizontal Tab (HT) (Ctrl-I). + * + * @vt: supported C0 HT "Horizontal Tabulation" "\t" "Move the cursor to the next character tab stop." */ public tab(): void { if (this._bufferService.buffer.x >= this._bufferService.cols) { @@ -767,6 +653,9 @@ export class InputHandler extends Disposable implements IInputHandler { * SO * Shift Out (Ctrl-N) -> Switch to Alternate Character Set. This invokes the * 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 { this._charsetService.setgLevel(1); @@ -776,6 +665,8 @@ export class InputHandler extends Disposable implements IInputHandler { * SI * Shift In (Ctrl-O) -> Switch to Standard Character Set. This invokes the G0 * character set (the default). + * + * @vt: supported C0 SI "Shift In" "\x0f" "Return to regular character set after Shift Out." */ public shiftIn(): void { this._charsetService.setgLevel(0); @@ -821,6 +712,8 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps A * 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 { // stop at scrollTop @@ -835,6 +728,8 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps B * 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 { // stop at scrollBottom @@ -849,6 +744,8 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps C * 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 { this._moveCursor(params.params[0] || 1, 0); @@ -857,6 +754,8 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps D * 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 { this._moveCursor(-(params.params[0] || 1), 0); @@ -866,6 +765,8 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps E * Cursor Next Line Ps Times (default = 1) (CNL). * 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 { this.cursorDown(params); @@ -876,6 +777,8 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps F * Cursor Previous Line Ps Times (default = 1) (CPL). * 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 { this.cursorUp(params); @@ -885,6 +788,8 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps G * 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 { 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 * 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 { this._setCursor( @@ -906,6 +813,8 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Pm ` Character Position Absolute * [column] (default = [row,1]) (HPA). * Currently same functionality as CHA. + * + * @vt: supported CSI HPA "Horizontal Position Absolute" "CSI Ps `" "Same as CHA." */ public charPosAbsolute(params: IParams): void { 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 * [columns] (default = [row,col+1]) (HPR) * Currently same functionality as CUF. + * + * @vt: supported CSI HPR "Horizontal Position Relative" "CSI Ps a" "Same as CUF." */ public hPositionRelative(params: IParams): void { 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) * [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 { 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) * [rows] (default = [row+1,column]) * 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 { 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 = * [1,1]) (HVP). * Same as CUP. + * + * @vt: supported CSI HVP "Horizontal and Vertical Position" "CSI Ps ; Ps f" "Same as CUP." */ public hVPosition(params: IParams): void { this.cursorPosition(params); @@ -954,6 +871,8 @@ export class InputHandler extends Disposable implements IInputHandler { * Potentially: * Ps = 2 -> Clear Stops on Line. * 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 { const param = params.params[0]; @@ -967,6 +886,8 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps I * 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 { 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). + * + * @vt: supported CSI CBT "Cursor Backward Tabulation" "CSI Ps Z" "Move cursor `Ps` tabs backward (default=1)." */ public cursorBackwardTab(params: IParams): void { 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 = 1 -> Selective Erase Above. * 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 { this._restrictCursor(); let j; @@ -1098,7 +1025,11 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 0 -> Selective Erase to Right (default). * Ps = 1 -> Selective Erase to Left. * 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 { this._restrictCursor(); switch (params.params[0]) { @@ -1118,6 +1049,8 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps L * 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 { this._restrictCursor(); @@ -1148,6 +1081,8 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps M * 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 { this._restrictCursor(); @@ -1197,6 +1132,8 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps P * 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 { this._restrictCursor(); @@ -1214,6 +1151,8 @@ export class InputHandler extends Disposable implements IInputHandler { /** * 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 { 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). + * + * @vt: supported CSI SD "Scroll Down" "CSI Ps T" "Scroll `Ps` lines down (default=1)." */ public scrollDown(params: IParams): void { let param = params.params[0] || 1; @@ -1257,6 +1198,8 @@ export class InputHandler extends Disposable implements IInputHandler { * * Supported: * - 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 { const buffer = this._bufferService.buffer; @@ -1285,6 +1228,8 @@ export class InputHandler extends Disposable implements IInputHandler { * * Supported: * - 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 { const buffer = this._bufferService.buffer; @@ -1303,6 +1248,8 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Pm ' } * 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 { const buffer = this._bufferService.buffer; @@ -1321,6 +1268,8 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Pm ' ~ * 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 { const buffer = this._bufferService.buffer; @@ -1339,6 +1288,8 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps X * 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 { 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, * 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 { if (!this._parser.precedingCodepoint) { @@ -1425,6 +1380,9 @@ export class InputHandler extends Disposable implements IInputHandler { * More information: * xterm/charproc.c - line 2012, for more information. * 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 { if (params.params[0] > 0) { @@ -1436,6 +1394,10 @@ export class InputHandler extends Disposable implements IInputHandler { 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 { if (params.params[0] > 0) { return; @@ -1541,6 +1503,9 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 2 0 0 4 -> Set bracketed paste mode. * Modes: * 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 { 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 { for (let i = 0; i < params.length; 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 1 -> Reset keyboard emulation to Sun/PC style. * 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 { 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 { for (let i = 0; i < params.length; i++) { switch (params.params[i]) { @@ -1947,6 +1923,9 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps. * Ps = 4 8 ; 5 ; Ps -> Set background color to the second * 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 { // Optimize a single SGR0. @@ -2068,6 +2047,8 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 5 3 -> Report Locator status as * CSI ? 5 3 n Locator available, if compiled-in, or * 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 { 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 { // modern xterm doesnt seem to // 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). * 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 { this._coreService.isCursorHidden = false; @@ -2138,6 +2126,15 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 4 -> steady underline. * Ps = 5 -> blinking 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 { const param = params.params[0] || 1; @@ -2163,6 +2160,9 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps ; Ps r * Set Scrolling Region [top;bottom] (default = full size of win- * 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 { const top = params.params[0] || 1; @@ -2184,7 +2184,10 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI s * ESC 7 * 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 { this._bufferService.buffer.savedX = this._bufferService.buffer.x; 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 * ESC 8 * 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 { this._bufferService.buffer.x = this._bufferService.buffer.savedX || 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; ST (set icon name + window title) * OSC 2; ST (set window title) * 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 { this._terminal.handleTitle(data); @@ -2226,7 +2239,10 @@ export class InputHandler extends Disposable implements IInputHandler { * C1.NEL * DEC mnemonic: NEL (https://vt100.net/docs/vt510-rm/NEL) * 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 { this._bufferService.buffer.x = 0; this.index(); @@ -2298,7 +2314,10 @@ export class InputHandler extends Disposable implements IInputHandler { * C1.IND * DEC mnemonic: IND (https://vt100.net/docs/vt510-rm/IND.html) * 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 { this._restrictCursor(); 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) * Sets a horizontal tab stop at the column position indicated by * 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 { this._bufferService.buffer.tabs[this._bufferService.buffer.x] = true; } @@ -2390,8 +2412,8 @@ export class InputHandler extends Disposable implements IInputHandler { * DEC mnemonic: DECALN (https://vt100.net/docs/vt510-rm/DECALN.html) * This control function fills the complete screen area with * 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 { // prepare cell data From 5b2ccdbda74c4449b4f01fde320b80648d8db4ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Sun, 5 Jan 2020 23:00:46 +0100 Subject: [PATCH 08/21] make linter happy --- src/InputHandler.ts | 102 ++++++++++++++++++++++---------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 5868f0dc..13ab57da 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -568,7 +568,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * BEL * 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`. @@ -580,7 +580,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * LF * 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." @@ -612,7 +612,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CR * Carriage Return (Ctrl-M). - * + * * @vt: supported C0 CR "Carriage Return" "\r" "Move the cursor to the beginning of the row." */ public carriageReturn(): void { @@ -622,7 +622,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * BS * Backspace (Ctrl-H). - * + * * @vt: supported C0 BS "Backspace" "\b" "Move the cursor one position to the left." */ public backspace(): void { @@ -635,7 +635,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * TAB * Horizontal Tab (HT) (Ctrl-I). - * + * * @vt: supported C0 HT "Horizontal Tabulation" "\t" "Move the cursor to the next character tab stop." */ public tab(): void { @@ -653,7 +653,7 @@ export class InputHandler extends Disposable implements IInputHandler { * SO * Shift Out (Ctrl-N) -> Switch to Alternate Character Set. This invokes the * 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 ... */ @@ -665,7 +665,7 @@ export class InputHandler extends Disposable implements IInputHandler { * SI * Shift In (Ctrl-O) -> Switch to Standard Character Set. This invokes the G0 * character set (the default). - * + * * @vt: supported C0 SI "Shift In" "\x0f" "Return to regular character set after Shift Out." */ public shiftIn(): void { @@ -712,7 +712,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps A * 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 { @@ -728,7 +728,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps B * 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 { @@ -744,7 +744,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps C * 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 { @@ -754,7 +754,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps D * 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 { @@ -765,7 +765,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps E * Cursor Next Line Ps Times (default = 1) (CNL). * 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 { @@ -777,7 +777,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps F * Cursor Previous Line Ps Times (default = 1) (CPL). * 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 { @@ -788,7 +788,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps G * 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 { @@ -798,7 +798,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps ; Ps H * 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 { @@ -813,7 +813,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Pm ` Character Position Absolute * [column] (default = [row,1]) (HPA). * Currently same functionality as CHA. - * + * * @vt: supported CSI HPA "Horizontal Position Absolute" "CSI Ps `" "Same as CHA." */ public charPosAbsolute(params: IParams): void { @@ -824,7 +824,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Pm a Character Position Relative * [columns] (default = [row,col+1]) (HPR) * Currently same functionality as CUF. - * + * * @vt: supported CSI HPR "Horizontal Position Relative" "CSI Ps a" "Same as CUF." */ public hPositionRelative(params: IParams): void { @@ -834,7 +834,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Pm d Vertical Position Absolute (VPA) * [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 { @@ -845,7 +845,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Pm e Vertical Position Relative (VPR) * [rows] (default = [row+1,column]) * 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 { @@ -857,7 +857,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Horizontal and Vertical Position [row;column] (default = * [1,1]) (HVP). * Same as CUP. - * + * * @vt: supported CSI HVP "Horizontal and Vertical Position" "CSI Ps ; Ps f" "Same as CUP." */ public hVPosition(params: IParams): void { @@ -871,7 +871,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Potentially: * Ps = 2 -> Clear Stops on Line. * 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 { @@ -886,7 +886,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps I * 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 { @@ -901,7 +901,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * 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 { @@ -961,7 +961,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 0 -> Selective Erase Below (default). * Ps = 1 -> Selective Erase Above. * 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... */ @@ -1025,7 +1025,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 0 -> Selective Erase to Right (default). * Ps = 1 -> Selective Erase to Left. * 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... */ @@ -1049,7 +1049,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps L * 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 { @@ -1081,7 +1081,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps M * 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 { @@ -1132,7 +1132,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps P * 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 { @@ -1151,7 +1151,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * 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 { @@ -1169,7 +1169,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * 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 { @@ -1198,7 +1198,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * Supported: * - 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 { @@ -1228,7 +1228,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * Supported: * - 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 { @@ -1248,7 +1248,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Pm ' } * 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 { @@ -1268,7 +1268,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Pm ' ~ * 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 { @@ -1288,7 +1288,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps X * 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 { @@ -1326,7 +1326,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * 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`. - * + * * @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 @@ -1380,7 +1380,7 @@ export class InputHandler extends Disposable implements IInputHandler { * More information: * xterm/charproc.c - line 2012, for more information. * 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... */ @@ -1503,7 +1503,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 2 0 0 4 -> Set bracketed paste mode. * Modes: * 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. */ @@ -1692,7 +1692,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 1 0 6 0 -> Reset legacy keyboard emulation (X11R6). * Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC style. * 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. */ @@ -1923,7 +1923,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps. * Ps = 4 8 ; 5 ; Ps -> Set background color to the second * Ps. - * + * * @vt: partly CSI SGR "Select Graphic Rendition" "CSI Pm m" "Set/Reset various text attributes." * Detailed description goes here... */ @@ -2047,7 +2047,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 5 3 -> Report Locator status as * CSI ? 5 3 n Locator available, if compiled-in, or * 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 { @@ -2098,7 +2098,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI ! p Soft terminal reset (DECSTR). * 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. @@ -2126,7 +2126,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 4 -> steady underline. * Ps = 5 -> blinking 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 @@ -2160,7 +2160,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps ; Ps r * Set Scrolling Region [top;bottom] (default = full size of win- * 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... */ @@ -2184,7 +2184,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI s * ESC 7 * 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." @@ -2201,7 +2201,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI u * ESC 8 * 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." @@ -2222,7 +2222,7 @@ export class InputHandler extends Disposable implements IInputHandler { * OSC 0; ST (set icon name + window title) * OSC 2; ST (set window title) * 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. */ @@ -2239,7 +2239,7 @@ export class InputHandler extends Disposable implements IInputHandler { * C1.NEL * DEC mnemonic: NEL (https://vt100.net/docs/vt510-rm/NEL) * 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." @@ -2314,7 +2314,7 @@ export class InputHandler extends Disposable implements IInputHandler { * C1.IND * DEC mnemonic: IND (https://vt100.net/docs/vt510-rm/IND.html) * 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." @@ -2337,7 +2337,7 @@ export class InputHandler extends Disposable implements IInputHandler { * DEC mnemonic: HTS (https://vt100.net/docs/vt510-rm/HTS.html) * Sets a horizontal tab stop at the column position indicated by * 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." @@ -2412,7 +2412,7 @@ export class InputHandler extends Disposable implements IInputHandler { * DEC mnemonic: DECALN (https://vt100.net/docs/vt510-rm/DECALN.html) * This control function fills the complete screen area with * a test pattern (E) used for adjusting screen alignment. - * + * * @vt: supported ESC DECALN "Screen Alignment Pattern" "ESC # 8" "Fill viewport with a test pattern (E)." */ public screenAlignmentPattern(): void { From fc2df6cfd67b635b19ec858e232dbede06b25363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Mon, 6 Jan 2020 23:58:30 +0100 Subject: [PATCH 09/21] all multiple @vt in one multiline comment --- bin/extract_vtfeatures.js | 69 +++++++++++++++++++----------------- src/InputHandler.ts | 74 +++++++++++++++++++++++++++++---------- 2 files changed, 92 insertions(+), 51 deletions(-) diff --git a/bin/extract_vtfeatures.js b/bin/extract_vtfeatures.js index 2122e19a..7c7eeb5c 100644 --- a/bin/extract_vtfeatures.js +++ b/bin/extract_vtfeatures.js @@ -33,8 +33,16 @@ const TYPES = [ ]; const MARKDOWN_TMPL = ` -# Supported VT features by xterm.js -Version: {{version}} + +### TODO +- improve table sorting: + - sort C0/C1 in byte order + - sort OSC in numerical order + - sort CSI/ESC/DCS in final byte order +- references + + +xterm.js version: {{version}} ### Table of Contents @@ -60,7 +68,7 @@ Version: {{version}} ### General notes -This document lists xterm.js' support of typical VT commands. The commands are grouped by their type: +This document lists xterm.js' support of terminal sequences. The sequences are grouped by their type: - C0: single byte command (7bit control characters, byte range \\x00 .. \\x1f) - C1: single byte command (8bit control characters, byte range \\x80 .. \\x9f) @@ -69,18 +77,18 @@ This document lists xterm.js' support of typical VT commands. The commands are g - DCS - Device Control String: sequence starting with \`ESC P\` (7bit) or DCS (\`\\x90\` 8bit) - OSC - Operating System Command: sequence starting with \`ESC ]\` (7bit) or OSC (\`\\x9d\` 8bit) -Application Program Command (APC), Privacy Message (PM) and Start of String (SOS) are not supported, -any sequence of these types will be ignored. +Application Program Command (APC), Privacy Message (PM) and Start of String (SOS) are recognized but not supported, +any sequence of these types will be ignored. They are also not hookable by the API. -Note that the list only contains commands implemented in xterm.js' core codebase. Missing commands are either -not supported or unstable/experimental. Furthermore addons can provide additional commands. +Note that the list only contains sequences implemented in xterm.js' core codebase. Missing sequences are either +not supported or unstable/experimental. Furthermore addons or integrations can provide additional custom sequences. -To denote the sequences the lists use the same abbreviations as xterm does: +To denote the sequences the following tables use the same abbreviations as xterm does: - \`Ps\`: A single (usually optional) numeric parameter, composed of one or more decimal digits. - \`Pm\`: A multiple numeric parameter composed of any number of single numeric parameters, separated by ; character(s), e.g. \` Ps ; Ps ; ... \`. - \`Pt\`: A text parameter composed of printable characters. Note that for most commands with \`Pt\` only - ASCII printables are specified to work. Additionally xterm.js will let any character >C1 pass as printable. + ASCII printables are specified to work. Additionally the parser will let pass any codepoint greater than C1 as printable. {{#C0.length}} @@ -219,32 +227,32 @@ To denote the sequences the lists use the same abbreviations as xterm does: {{/OSC.hasLongDescriptions}} {{/OSC.length}} - - -### TODO -- improve table sorting: - - sort C0/C1 in byte order - - sort OSC in numerical order - - sort CSI/ESC/DCS in final byte order -- references ` function createAnchorSlug(s) { return s.toLowerCase().split(' ').join('-'); } -function parseMultiLine(filename, s) { +function* parseMultiLineGen(filename, s) { if (!~s.indexOf('@vt:')) { return; } const lines = s.split('\n').map(el => el.trim().replace(/[*]/, '').replace(/\s/, '')); let grabLine = false; - const longDescription = []; - let feature; + let longDescription = []; + let feature = undefined; for (const line of lines) { if (grabLine) { if (!line) { - break; + if (feature) { + feature.longDescription = longDescription; + feature.longTarget = createAnchorSlug(feature.name); + yield feature; + } + grabLine = false; + longDescription = []; + feature = undefined; + continue; } longDescription.push(line); } @@ -253,11 +261,6 @@ function parseMultiLine(filename, s) { grabLine = true; } } - if (feature) { - feature.longDescription = longDescription; - feature.longTarget = createAnchorSlug(feature.name); - return feature; - } } function parseSingleLine(filename, s) { @@ -288,7 +291,7 @@ function postProcessData(features) { featureTable[feature.type] = []; } featureTable[feature.type].push(feature); - if (feature.longDescription) { + if (feature.longDescription.length) { featureTable[feature.type].hasLongDescriptions = true; } } @@ -311,11 +314,13 @@ function main(filenames) { if (match.index === REX_COMMENTS.lastIndex) { REX_COMMENTS.lastIndex++; } - const feature = match[1] - ? parseMultiLine(filename, match[1]) - : parseSingleLine(filename, match[2]); - if (feature) { - features.push(feature); + if (match[1]) { + for (let feature of parseMultiLineGen(filename, match[1])) { + if (feature) features.push(feature); + } + } else { + const feature = parseSingleLine(filename, match[2]); + if (feature) features.push(feature); } } leftToProcess--; diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 13ab57da..44c68f0b 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -28,6 +28,22 @@ import { DcsHandler } from 'common/parser/DcsParser'; */ const GLEVEL: {[key: string]: number} = {'(': 0, ')': 1, '*': 2, '+': 3, '-': 1, '.': 2}; +/** + * VT commands done by the parser - FIXME: move this to the parser? + */ +// @vt: supported ESC CSI "Control Sequence Introducer" "ESC [" "Start of a CSI sequence." +// @vt: supported ESC OSC "Operating System Command" "ESC ]" "Start of an OSC sequence." +// @vt: supported ESC DCS "Device Control String" "ESC P" "Start of a DCS sequence." +// @vt: supported ESC ST "String Terminator" "ESC \" "Terminator used for string type sequences." +// @vt: supported ESC PM "Privacy Message" "ESC ^" "Start of a privacy message." +// @vt: supported ESC APC "Application Program Command" "ESC _" "Start of an APC sequence." +// @vt: supported C1 CSI "Control Sequence Introducer" "\x9b" "Start of a CSI sequence." +// @vt: supported C1 OSC "Operating System Command" "\x9d" "Start of an OSC sequence." +// @vt: supported C1 DCS "Device Control String" "\x90" "Start of a DCS sequence." +// @vt: supported C1 ST "String Terminator" "\x9c" "Terminator used for string type sequences." +// @vt: supported C1 PM "Privacy Message" "\x9e" "Start of a privacy message." +// @vt: supported C1 APC "Application Program Command" "\x9f" "Start of an APC sequence." + /** * Document common VT features here that are currently unsupported */ @@ -50,11 +66,13 @@ const MAX_PARSEBUFFER_LENGTH = 131072; * Request Status String (DECRQSS), VT420 and up. * Response: DECRPSS (https://vt100.net/docs/vt510-rm/DECRPSS.html) * - * @vt: partly DCS DECRQSS "Request Selection or Setting" "DCS $ q Pt ST" "Request several the terminal settings." - * Supported: - * - Graphic Rendition (SGR): `DCS $ q m ST` (always reporting 0m) - * - Top and Bottom Margins (DECSTBM): `DCS $ q m ST` - * - Cursor Style (DECSCUSR): `DCS $ q SP q ST` + * @vt: partly DCS DECRQSS "Request Selection or Setting" "DCS $ q Pt ST" "Request several terminal settings." + * Supported requests and responses: + * | Type | Request | Response | + * | -------------------------------- | ----------------- | -------- | + * | Graphic Rendition (SGR) | `DCS $ q m ST` | currently broken (reporting `0m`) | + * | Top and Bottom Margins (DECSTBM) | `DCS $ q m ST` | .... | + * | Cursor Style (DECSCUSR) | `DCS $ q SP q ST` | .... | */ class DECRQSS implements IDcsHandler { private _data: Uint32Array = new Uint32Array(0); @@ -111,18 +129,24 @@ class DECRQSS implements IDcsHandler { * DCS Ps; Ps| Pt ST * DECUDK (https://vt100.net/docs/vt510-rm/DECUDK.html) * not supported + * + * @vt: unsupported DCS DECUDK "User Defined Keys" "DCS Ps ; Ps | Pt ST" "Definitions for user-defined keys." */ /** * DCS + q Pt ST (xterm) * Request Terminfo String * not implemented + * + * @vt: unsupported DCS XTGETTCAP "Request Terminfo String" "DCS + q Pt ST" "Request Terminfo String." */ /** * DCS + p Pt ST (xterm) * Set Terminfo Data * not supported + * + * @vt: unsupported DCS XTSETTCAP "Set Terminfo Data" "DCS + p Pt ST" "Set Terminfo Data." */ @@ -315,7 +339,6 @@ export class InputHandler extends Disposable implements IInputHandler { this._parser.setEscHandler({final: 'D'}, () => this.index()); this._parser.setEscHandler({final: 'E'}, () => this.nextLine()); this._parser.setEscHandler({final: 'H'}, () => this.tabSet()); - // @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: '='}, () => this.keypadApplicationMode()); this._parser.setEscHandler({final: '>'}, () => this.keypadNumericMode()); @@ -581,10 +604,12 @@ export class InputHandler extends Disposable implements IInputHandler { * LF * 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 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." */ - // @vt: supported C0 VT "Vertical Tabulation" "\v" "Treated as LF." - // @vt: supported C0 FF "Form Feed" "\f" "Treated as LF." public lineFeed(): void { // make buffer local for faster access const buffer = this._bufferService.buffer; @@ -964,8 +989,9 @@ export class InputHandler extends Disposable implements IInputHandler { * * @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." */ - // @vt: partly CSI DECSED "Selective Erase In Display" "CSI ? Ps J" "Currently the same as ED." public eraseInDisplay(params: IParams): void { this._restrictCursor(); let j; @@ -1028,8 +1054,9 @@ export class InputHandler extends Disposable implements IInputHandler { * * @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." */ - // @vt: partly CSI DECSEL "Selective Erase In Line" "CSI ? Ps K" "Currently the same as EL." public eraseInLine(params: IParams): void { this._restrictCursor(); switch (params.params[0]) { @@ -1394,6 +1421,7 @@ export class InputHandler extends Disposable implements IInputHandler { this._coreService.triggerDataEvent(C0.ESC + '[?6c'); } } + /** * @vt: supported CSI DA2 "Secondary Device Attributes" "CSI > c" "Send primary device attributes." * TODO: Describe response... @@ -1519,6 +1547,7 @@ 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. @@ -1708,6 +1737,7 @@ 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. @@ -2128,7 +2158,7 @@ export class InputHandler extends Disposable implements IInputHandler { * 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`): + * Supported cursor styles (TODO: add note about `ITerminalOptions.cursorBlink`): * - empty, 0 or 1: steady block * - 2: blink block * - 3: steady underline @@ -2186,8 +2216,9 @@ export class InputHandler extends Disposable implements IInputHandler { * 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." */ - // @vt: supported ESC SC "Save Cursor" "ESC 7" "Save cursor position, charmap and text attributes." public saveCursor(params?: IParams): void { this._bufferService.buffer.savedX = this._bufferService.buffer.x; this._bufferService.buffer.savedY = this._bufferService.buffer.ybase + this._bufferService.buffer.y; @@ -2203,8 +2234,9 @@ export class InputHandler extends Disposable implements IInputHandler { * 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." */ - // @vt: supported ESC RC "Restore Cursor" "ESC 8" "Restore cursor position, charmap and text attributes." public restoreCursor(params?: IParams): void { this._bufferService.buffer.x = this._bufferService.buffer.savedX || 0; this._bufferService.buffer.y = Math.max(this._bufferService.buffer.savedY - this._bufferService.buffer.ybase, 0); @@ -2225,8 +2257,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * @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`. */ @@ -2241,8 +2272,9 @@ export class InputHandler extends Disposable implements IInputHandler { * 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." */ - // @vt: supported ESC NEL "Next Line" "ESC E" "Move the cursor to the beginning of the next row." public nextLine(): void { this._bufferService.buffer.x = 0; this.index(); @@ -2316,8 +2348,9 @@ export class InputHandler extends Disposable implements IInputHandler { * 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." */ - // @vt: supported ESC IND "Index" "ESC D" "Move the cursor one line down scrolling if needed." public index(): void { this._restrictCursor(); const buffer = this._bufferService.buffer; @@ -2339,8 +2372,9 @@ export class InputHandler extends Disposable implements IInputHandler { * 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." */ - // @vt: supported ESC HTS "Horizontal Tabulation Set" "ESC H" "Places a tab stop at the current cursor position." public tabSet(): void { this._bufferService.buffer.tabs[this._bufferService.buffer.x] = true; } @@ -2351,6 +2385,8 @@ export class InputHandler extends Disposable implements IInputHandler { * DEC mnemonic: HTS * Moves the cursor up one line in the same column. If the cursor is at the top margin, * the page scrolls down. + * + * @vt: supported ESC IR "Reverse Index" "ESC M" "Move the cursor one line up scrolling if needed." */ public reverseIndex(): void { this._restrictCursor(); From dae8c3599b872b69565f4bc2108091197a7a7ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Tue, 7 Jan 2020 00:47:07 +0100 Subject: [PATCH 10/21] make linter happy --- src/InputHandler.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 44c68f0b..09d351c6 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -129,7 +129,7 @@ class DECRQSS implements IDcsHandler { * DCS Ps; Ps| Pt ST * DECUDK (https://vt100.net/docs/vt510-rm/DECUDK.html) * not supported - * + * * @vt: unsupported DCS DECUDK "User Defined Keys" "DCS Ps ; Ps | Pt ST" "Definitions for user-defined keys." */ @@ -137,7 +137,7 @@ class DECRQSS implements IDcsHandler { * DCS + q Pt ST (xterm) * Request Terminfo String * not implemented - * + * * @vt: unsupported DCS XTGETTCAP "Request Terminfo String" "DCS + q Pt ST" "Request Terminfo String." */ @@ -145,7 +145,7 @@ class DECRQSS implements IDcsHandler { * DCS + p Pt ST (xterm) * Set Terminfo Data * not supported - * + * * @vt: unsupported DCS XTSETTCAP "Set Terminfo Data" "DCS + p Pt ST" "Set Terminfo Data." */ @@ -605,9 +605,9 @@ export class InputHandler extends Disposable implements IInputHandler { * 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 { @@ -989,7 +989,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * @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 { @@ -1054,7 +1054,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * @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 { @@ -2216,7 +2216,7 @@ export class InputHandler extends Disposable implements IInputHandler { * 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 { @@ -2234,7 +2234,7 @@ export class InputHandler extends Disposable implements IInputHandler { * 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 { @@ -2257,7 +2257,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * @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`. */ @@ -2272,7 +2272,7 @@ export class InputHandler extends Disposable implements IInputHandler { * 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 { @@ -2348,7 +2348,7 @@ export class InputHandler extends Disposable implements IInputHandler { * 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 { @@ -2372,7 +2372,7 @@ export class InputHandler extends Disposable implements IInputHandler { * 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 { @@ -2385,7 +2385,7 @@ export class InputHandler extends Disposable implements IInputHandler { * DEC mnemonic: HTS * Moves the cursor up one line in the same column. If the cursor is at the top margin, * the page scrolls down. - * + * * @vt: supported ESC IR "Reverse Index" "ESC M" "Move the cursor one line up scrolling if needed." */ public reverseIndex(): void { From e240160d397615f3bb2ccdb04a80c5801268d819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Tue, 7 Jan 2020 01:01:46 +0100 Subject: [PATCH 11/21] break command definition on new @vt entry --- bin/extract_vtfeatures.js | 16 +++++++++++++--- src/InputHandler.ts | 7 ------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/bin/extract_vtfeatures.js b/bin/extract_vtfeatures.js index 7c7eeb5c..de91dca5 100644 --- a/bin/extract_vtfeatures.js +++ b/bin/extract_vtfeatures.js @@ -252,11 +252,21 @@ function* parseMultiLineGen(filename, s) { grabLine = false; longDescription = []; feature = undefined; - continue; } - longDescription.push(line); + else if (line.indexOf('@vt:') === 0) { + if (feature) { + feature.longDescription = []; + feature.longTarget = createAnchorSlug(feature.name); + yield feature; + } + grabLine = true; + longDescription = []; + feature = undefined; + } else { + longDescription.push(line); + } } - if (~line.indexOf('@vt:')) { + if (line.indexOf('@vt:') === 0) { feature = parseSingleLine(filename, line); grabLine = true; } diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 09d351c6..0e0c5ebb 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -605,9 +605,7 @@ export class InputHandler extends Disposable implements IInputHandler { * 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 { @@ -2216,7 +2214,6 @@ export class InputHandler extends Disposable implements IInputHandler { * 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 { @@ -2234,7 +2231,6 @@ export class InputHandler extends Disposable implements IInputHandler { * 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 { @@ -2272,7 +2268,6 @@ export class InputHandler extends Disposable implements IInputHandler { * 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 { @@ -2348,7 +2343,6 @@ export class InputHandler extends Disposable implements IInputHandler { * 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 { @@ -2372,7 +2366,6 @@ export class InputHandler extends Disposable implements IInputHandler { * 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 { From 016d176cbde304e854de8be20ae5405d5e0f5a6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Wed, 8 Jan 2020 17:51:56 +0100 Subject: [PATCH 12/21] more docs --- src/InputHandler.ts | 100 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 84 insertions(+), 16 deletions(-) diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 0e0c5ebb..41a6c0e7 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -67,12 +67,22 @@ const MAX_PARSEBUFFER_LENGTH = 131072; * Response: DECRPSS (https://vt100.net/docs/vt510-rm/DECRPSS.html) * * @vt: partly DCS DECRQSS "Request Selection or Setting" "DCS $ q Pt ST" "Request several terminal settings." + * Response is in the form `ESC P 1 $ r Pt ST` for valid requests, where `Pt` contains the corresponding CSI string, + * `ESC P 0 ST` for invalid requests. * Supported requests and responses: - * | Type | Request | Response | - * | -------------------------------- | ----------------- | -------- | - * | Graphic Rendition (SGR) | `DCS $ q m ST` | currently broken (reporting `0m`) | - * | Top and Bottom Margins (DECSTBM) | `DCS $ q m ST` | .... | - * | Cursor Style (DECSCUSR) | `DCS $ q SP q ST` | .... | + * | Type | Request | Response (`Pt`) | + * | -------------------------------- | ----------------- | ------------------ | + * | Graphic Rendition (SGR) | `DCS $ q m ST` | always reporting `0m` (currently broken) | + * | Top and Bottom Margins (DECSTBM) | `DCS $ q r ST` | `Ptop ; Pbottom r` | + * | Cursor Style (DECSCUSR) | `DCS $ q SP q ST` | `Pstyle SP q` | + * | Protection Attribute (DECSCA) | `DCS $ q " q ST` | always reporting `0 " q` (DECSCA is unsupported) | + * | Conformance Level (DECSCL) | `DCS $ q " p ST` | always reporting `61 ; 1 " p` (DECSCL is unsupported) | + * + * TODO: + * - fix SGR report + * - either implement DECSCA or remove the report + * - either check which conformance is better suited or remove the report completely + * --> we are currently a mixture of all up to VT400 but dont follow anyone strictly */ class DECRQSS implements IDcsHandler { private _data: Uint32Array = new Uint32Array(0); @@ -104,7 +114,7 @@ class DECRQSS implements IDcsHandler { case '"q': // DECSCA return this._coreService.triggerDataEvent(`${C0.ESC}P1$r0"q${C0.ESC}\\`); case '"p': // DECSCL - return this._coreService.triggerDataEvent(`${C0.ESC}P1$r61"p${C0.ESC}\\`); + return this._coreService.triggerDataEvent(`${C0.ESC}P1$r61;1"p${C0.ESC}\\`); case 'r': // DECSTBM const pt = '' + (this._bufferService.buffer.scrollTop + 1) + ';' + (this._bufferService.buffer.scrollBottom + 1) + 'r'; @@ -605,6 +615,8 @@ export class InputHandler extends Disposable implements IInputHandler { * 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." + * Scrolling is restricted to scroll margins and will only happen on the bottom line. + * * @vt: supported C0 VT "Vertical Tabulation" "\v" "Treated as LF." * @vt: supported C0 FF "Form Feed" "\f" "Treated as LF." */ @@ -678,7 +690,6 @@ export class InputHandler extends Disposable implements IInputHandler { * 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 { this._charsetService.setgLevel(1); @@ -737,6 +748,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Cursor Up Ps Times (default = 1) (CUU). * * @vt: supported CSI CUU "Cursor Up" "CSI Ps A" "Move cursor `Ps` times up (default=1)." + * If the cursor would pass the top scroll margin, it will stop there. */ public cursorUp(params: IParams): void { // stop at scrollTop @@ -753,6 +765,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Cursor Down Ps Times (default = 1) (CUD). * * @vt: supported CSI CUD "Cursor Down" "CSI Ps B" "Move cursor `Ps` times down (default=1)." + * If the cursor would pass the bottom scroll margin, it will stop there. */ public cursorDown(params: IParams): void { // stop at scrollBottom @@ -790,6 +803,7 @@ export class InputHandler extends Disposable implements IInputHandler { * 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." + * Same as CUD, additionally places the cursor at the first column. */ public cursorNextLine(params: IParams): void { this.cursorDown(params); @@ -802,6 +816,7 @@ export class InputHandler extends Disposable implements IInputHandler { * 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." + * Same as CUU, additionally places the cursor at the first column. */ public cursorPrecedingLine(params: IParams): void { this.cursorUp(params); @@ -823,6 +838,9 @@ export class InputHandler extends Disposable implements IInputHandler { * 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])." + * If ORIGIN mode is set, places the cursor to the absolute position within the scroll margins. + * If ORIGIN mode is not set, places the cursor to the absolute position within the viewport. + * Note that the coordinates are 1-based, thus the top left position starts at `1 ; 1`. */ public cursorPosition(params: IParams): void { this._setCursor( @@ -846,7 +864,6 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Pm a Character Position Relative * [columns] (default = [row,col+1]) (HPR) - * Currently same functionality as CUF. * * @vt: supported CSI HPR "Horizontal Position Relative" "CSI Ps a" "Same as CUF." */ @@ -896,6 +913,7 @@ export class InputHandler extends Disposable implements IInputHandler { * 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)." + * Clearing tabstops off the active row (Ps = 2, VT100) is currently not supported. */ public tabClear(params: IParams): void { const param = params.params[0]; @@ -986,7 +1004,13 @@ export class InputHandler extends Disposable implements IInputHandler { * 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... + * Supported param values: + * | Ps | Effect | + * | -- | ------------------------------------------------------------ | + * | 0 | Erase from the cursor through the end of the viewport. | + * | 1 | Erase from the beginning of the viewport through the cursor. | + * | 2 | Erase complete viewport. | + * | 3 | Erase scrollback. | * * @vt: partly CSI DECSED "Selective Erase In Display" "CSI ? Ps J" "Currently the same as ED." */ @@ -1051,7 +1075,12 @@ export class InputHandler extends Disposable implements IInputHandler { * 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... + * Supported param values: + * | Ps | Effect | + * | -- | -------------------------------------------------------- | + * | 0 | Erase from the cursor through the end of the row. | + * | 1 | Erase from the beginning of the line through the cursor. | + * | 2 | Erase complete line. | * * @vt: partly CSI DECSEL "Selective Erase In Line" "CSI ? Ps K" "Currently the same as EL." */ @@ -1076,6 +1105,9 @@ export class InputHandler extends Disposable implements IInputHandler { * 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)." + * For every inserted line at the scroll top one line at the scroll bottom gets removed. + * The cursor is set to the first column. + * IL has no effect if the cursor is outside the scroll margins. */ public insertLines(params: IParams): void { this._restrictCursor(); @@ -1108,6 +1140,9 @@ export class InputHandler extends Disposable implements IInputHandler { * Delete Ps Line(s) (default = 1) (DL). * * @vt: supported CSI DL "Delete Line" "CSI Ps M" "Delete `Ps` lines at active row (default=1)." + * For every deleted line at the scroll top one blank line at the scroll bottom gets appended. + * The cursor is set to the first column. + * DL has no effect if the cursor is outside the scroll margins. */ public deleteLines(params: IParams): void { this._restrictCursor(); @@ -1139,6 +1174,12 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Ps @ * Insert Ps (Blank) Character(s) (default = 1) (ICH). + * + * @vt: supported CSI ICH "Insert Characters" "CSI Ps @" "Insert `Ps` (blank) characters (default = 1)." + * The ICH sequence inserts `Ps` blank characters. The cursor remains at the beginning of the blank characters. + * Text between the cursor and right margin moves to the right. Characters moved past the right margin are lost. + * + * FIXME: check against xterm - should not work outside of scroll margins (see VT520 manual) */ public insertChars(params: IParams): void { this._restrictCursor(); @@ -1158,7 +1199,11 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps P * 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)." + * @vt: supported CSI DCH "Delete Character" "CSI Ps P" "Delete `Ps` characters (default=1)." + * As characters are deleted, the remaining characters between the cursor and right margin move to the left. + * Character attributes move with the characters. The terminal adds blank characters at the right margin. + * + * FIXME: check against xterm - should not work outside of scroll margins (see VT520 manual) */ public deleteChars(params: IParams): void { this._restrictCursor(); @@ -1178,6 +1223,9 @@ export class InputHandler extends Disposable implements IInputHandler { * 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)." + * TODO: explain behavior... + * + * FIXME: scrolled out lines at top = 1 should add to scrollback (xterm) */ public scrollUp(params: IParams): void { let param = params.params[0] || 1; @@ -1196,6 +1244,7 @@ export class InputHandler extends Disposable implements IInputHandler { * 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)." + * TODO: explain behavior... */ public scrollDown(params: IParams): void { let param = params.params[0] || 1; @@ -1225,6 +1274,8 @@ export class InputHandler extends Disposable implements IInputHandler { * - always left shift (no line orientation setting respected) * * @vt: supported CSI SL "Scroll Left" "CSI Ps SP @" "Scroll viewport `Ps` times to the left." + * SL moves the content of all lines within the scroll margins `Ps` times to the left. + * SL has no effect outside of the scroll margins. */ public scrollLeft(params: IParams): void { const buffer = this._bufferService.buffer; @@ -1255,6 +1306,9 @@ export class InputHandler extends Disposable implements IInputHandler { * - 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." + * SL moves the content of all lines within the scroll margins `Ps` times to the right. + * Content at the right margin is lost. + * SL has no effect outside of the scroll margins. */ public scrollRight(params: IParams): void { const buffer = this._bufferService.buffer; @@ -1275,6 +1329,9 @@ export class InputHandler extends Disposable implements IInputHandler { * Insert Ps Column(s) (default = 1) (DECIC), VT420 and up. * * @vt: supported CSI DECIC "Insert Columns" "CSI Ps ' }" "Insert `Ps` columns at cursor position." + * DECIC inserts `Ps` times blank columns at the cursor position for all lines with the scroll margins, + * moving content to the right. Content at the right margin is lost. + * DECIC has no effect outside the scrolling margins. */ public insertColumns(params: IParams): void { const buffer = this._bufferService.buffer; @@ -1295,6 +1352,9 @@ export class InputHandler extends Disposable implements IInputHandler { * Delete Ps Column(s) (default = 1) (DECDC), VT420 and up. * * @vt: supported CSI DECDC "Delete Columns" "CSI Ps ' ~" "Delete `Ps` columns at cursor position." + * DECDC deletes `Ps` times columns at the cursor position for all lines with the scroll margins, + * moving content to the left. Blank columns are added at the right margin. + * DECDC has no effect outside the scrolling margins. */ public deleteColumns(params: IParams): void { const buffer = this._bufferService.buffer; @@ -1314,7 +1374,9 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps X * 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)." + * @vt: supported CSI ECH "Erase Character" "CSI Ps X" "Erase `Ps` characters from current cursor position to the right (default=1)." + * ED erases `Ps` characters from current cursor position to the right. + * ED works inside or outside the scrolling margins. */ public eraseChars(params: IParams): void { this._restrictCursor(); @@ -1353,8 +1415,9 @@ export class InputHandler extends Disposable implements IInputHandler { * 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 + * REP repeats the previous character `Ps` times advancing the cursor, also wrapping if DECAWM is set. + * REP no effect if the sequence does not follow a printable ASCII character + * (NOOP for any other sequence in between or NON ASCII characters). */ public repeatPrecedingCharacter(params: IParams): void { if (!this._parser.precedingCodepoint) { @@ -2131,7 +2194,13 @@ export class InputHandler extends Disposable implements IInputHandler { * 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 ... + * - cursor is reset (default = visible, home position) + * - IRM is reset (dafault = false) + * - scroll margins are reset (default = viewport size) + * - erase attributes are reset to default + * - charsets are reset + * + * FIXME: there are several more attributes missing (see VT520 manual) */ public softReset(params: IParams): void { this._coreService.isCursorHidden = false; @@ -2190,7 +2259,6 @@ export class InputHandler extends Disposable implements IInputHandler { * 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 { const top = params.params[0] || 1; From 297ea529a2dae92fb108f1d3d2427527cc65f77d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Wed, 8 Jan 2020 18:08:39 +0100 Subject: [PATCH 13/21] make linter happy --- src/InputHandler.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 41a6c0e7..8279d03e 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -68,7 +68,7 @@ const MAX_PARSEBUFFER_LENGTH = 131072; * * @vt: partly DCS DECRQSS "Request Selection or Setting" "DCS $ q Pt ST" "Request several terminal settings." * Response is in the form `ESC P 1 $ r Pt ST` for valid requests, where `Pt` contains the corresponding CSI string, - * `ESC P 0 ST` for invalid requests. + * `ESC P 0 ST` for invalid requests.\ * Supported requests and responses: * | Type | Request | Response (`Pt`) | * | -------------------------------- | ----------------- | ------------------ | @@ -77,7 +77,7 @@ const MAX_PARSEBUFFER_LENGTH = 131072; * | Cursor Style (DECSCUSR) | `DCS $ q SP q ST` | `Pstyle SP q` | * | Protection Attribute (DECSCA) | `DCS $ q " q ST` | always reporting `0 " q` (DECSCA is unsupported) | * | Conformance Level (DECSCL) | `DCS $ q " p ST` | always reporting `61 ; 1 " p` (DECSCL is unsupported) | - * + * * TODO: * - fix SGR report * - either implement DECSCA or remove the report @@ -472,7 +472,6 @@ export class InputHandler extends Disposable implements IInputHandler { } // insert combining char at last cursor position - // FIXME: needs handling after cursor jumps // buffer.x should never be 0 for a combining char // since they always follow a cell consuming char // therefore we can test for buffer.x to avoid overflow left @@ -489,10 +488,8 @@ export class InputHandler extends Disposable implements IInputHandler { } // goto next line if ch would overflow - // TODO: needs a global min terminal width of 2 - // FIXME: additionally ensure chWidth fits into a line - // --> maybe forbid cols= cols) { // autowrap - DECAWM // automatically wraps to the beginning of the next line @@ -616,7 +613,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * @vt: supported C0 LF "Line Feed" "\n" "Move the cursor one row down, scrolling if needed." * Scrolling is restricted to scroll margins and will only happen on the bottom line. - * + * * @vt: supported C0 VT "Vertical Tabulation" "\v" "Treated as LF." * @vt: supported C0 FF "Form Feed" "\f" "Treated as LF." */ @@ -1224,7 +1221,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * @vt: supported CSI SU "Scroll Up" "CSI Ps S" "Scroll `Ps` lines up (default=1)." * TODO: explain behavior... - * + * * FIXME: scrolled out lines at top = 1 should add to scrollback (xterm) */ public scrollUp(params: IParams): void { @@ -2199,7 +2196,7 @@ export class InputHandler extends Disposable implements IInputHandler { * - scroll margins are reset (default = viewport size) * - erase attributes are reset to default * - charsets are reset - * + * * FIXME: there are several more attributes missing (see VT520 manual) */ public softReset(params: IParams): void { From b51226f76c48d117a5e4c33130dc4a4579144aff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Thu, 9 Jan 2020 00:00:19 +0100 Subject: [PATCH 14/21] docs for SM/RM/DECSET/DECRST/SGR --- src/InputHandler.ts | 305 +++++++++++++++++++++++++++----------------- 1 file changed, 186 insertions(+), 119 deletions(-) diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 8279d03e..16a19d95 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -1220,7 +1220,6 @@ export class InputHandler extends Disposable implements IInputHandler { * 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)." - * TODO: explain behavior... * * FIXME: scrolled out lines at top = 1 should add to scrollback (xterm) */ @@ -1241,7 +1240,6 @@ export class InputHandler extends Disposable implements IInputHandler { * 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)." - * TODO: explain behavior... */ public scrollDown(params: IParams): void { let param = params.params[0] || 1; @@ -1448,6 +1446,23 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 1 5 -> Technical characters. * Ps = 2 2 -> ANSI color, e.g., VT525. * Ps = 2 9 -> ANSI text locator (i.e., DEC Locator mode). + * + * @vt: supported CSI DA1 "Primary Device Attributes" "CSI c" "Send primary device attributes." + * + * TODO: fix and cleanup response + */ + public sendDeviceAttributesPrimary(params: IParams): void { + if (params.params[0] > 0) { + return; + } + if (this._terminal.is('xterm') || this._terminal.is('rxvt-unicode') || this._terminal.is('screen')) { + this._coreService.triggerDataEvent(C0.ESC + '[?1;2c'); + } else if (this._terminal.is('linux')) { + this._coreService.triggerDataEvent(C0.ESC + '[?6c'); + } + } + + /** * CSI > Ps c * Send Device Attributes (Secondary DA). * Ps = 0 or omitted -> request the terminal's identification @@ -1466,23 +1481,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 (?) * - * @vt: supported CSI DA1 "Primary Device Attributes" "CSI c" "Send primary device attributes." - * TODO: Describe response... - */ - public sendDeviceAttributesPrimary(params: IParams): void { - if (params.params[0] > 0) { - return; - } - if (this._terminal.is('xterm') || this._terminal.is('rxvt-unicode') || this._terminal.is('screen')) { - this._coreService.triggerDataEvent(C0.ESC + '[?1;2c'); - } else if (this._terminal.is('linux')) { - this._coreService.triggerDataEvent(C0.ESC + '[?6c'); - } - } - - /** * @vt: supported CSI DA2 "Secondary Device Attributes" "CSI > c" "Send primary device attributes." - * TODO: Describe response... + * + * TODO: fix and cleanup response */ public sendDeviceAttributesSecondary(params: IParams): void { if (params.params[0] > 0) { @@ -1510,6 +1511,32 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 4 -> Insert Mode (IRM). * Ps = 1 2 -> Send/receive (SRM). * Ps = 2 0 -> Automatic Newline (LNM). + * + * @vt: partly CSI SM "Set Mode" "CSI Pm h" "Set various terminal modes." + * Supported param values by SM: + * | Param | Action | Status | + * | ----- | -------------------------------------- | ----------- | + * | 2 | Keyboard Action Mode (KAM). Always on. | unsupported | + * | 4 | Insert Mode (IRM). | supported | + * | 12 | Send/receive (SRM). Always off. | unsupported | + * | 20 | Automatic Newline (LNM). Always off. | unsupported | + * + * FIXME: why is LNM commented out? + */ + public setMode(params: IParams): void { + for (let i = 0; i < params.length; i++) { + switch (params.params[i]) { + case 4: + this._terminal.insertMode = true; + break; + case 20: + // this._t.convertEol = true; + break; + } + } + } + + /** * CSI ? Pm h * DEC Private Mode Set (DECSET). * Ps = 1 -> Application Cursor Keys (DECCKM). @@ -1590,25 +1617,34 @@ export class InputHandler extends Disposable implements IInputHandler { * Modes: * 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 { - for (let i = 0; i < params.length; i++) { - switch (params.params[i]) { - case 4: - this._terminal.insertMode = true; - break; - case 20: - // this._t.convertEol = true; - break; - } - } - } - - /** * @vt: partly CSI DECSET "DEC Private Set Mode" "CSI ? Pm h" "Set various terminal attributes." - * TODO: Describe all supported attributes. + * Supported param values by DECSET: + * | param | Action | Status | + * | ----- | ------------------------------------------------------- | ----------- | + * | 1 | Application Cursor Keys (DECCKM). | supported | + * | 2 | Designate US-ASCII for character sets G0-G3 (DECANM). | supported | + * | 3 | 132 Column Mode (DECCOLM). | supported | + * | 6 | Origin Mode (DECOM). | supported | + * | 7 | Auto-wrap Mode (DECAWM). | supported | + * | 8 | Auto-repeat Keys (DECARM). Always on. | unsupported | + * | 9 | X10 xterm mouse protocol. | supported | + * | 12 | Start Blinking Cursor. | supported | + * | 25 | Show Cursor (DECTCEM). | supported | + * | 47 | Use Alternate Screen Buffer. | supported | + * | 66 | Application keypad (DECNKM). | supported | + * | 1000 | X11 xterm mouse protocol. | supported | + * | 1002 | Use Cell Motion Mouse Tracking. | supported | + * | 1003 | Use All Motion Mouse Tracking. | supported | + * | 1004 | Send FocusIn/FocusOut events | supported | + * | 1005 | Enable UTF-8 Mouse Mode. | unsupported | + * | 1006 | Enable SGR Mouse Mode. | supported | + * | 1015 | Enable urxvt Mouse Mode. | unsupported | + * | 1047 | Use Alternate Screen Buffer. | supported | + * | 1048 | Save cursor as in DECSC. | supported | + * | 1049 | Save cursor and switch to alternate buffer clearing it. | partly | + * | 2004 | Set bracketed paste mode. | supported | + * + * FIXME: implement DECSCNM, 1049 should clear altbuffer */ public setModePrivate(params: IParams): void { for (let i = 0; i < params.length; i++) { @@ -1704,6 +1740,32 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 4 -> Replace Mode (IRM). * Ps = 1 2 -> Send/receive (SRM). * Ps = 2 0 -> Normal Linefeed (LNM). + * + * @vt: partly CSI RM "Reset Mode" "CSI Pm l" "Set various terminal attributes." + * Supported param values by RM: + * | Param | Action | Status | + * | ----- | -------------------------------------- | ----------- | + * | 2 | Keyboard Action Mode (KAM). Always on. | unsupported | + * | 4 | Replace Mode (IRM). (default) | supported | + * | 12 | Send/receive (SRM). Always off. | unsupported | + * | 20 | Normal Linefeed (LNM). Always off. | unsupported | + * + * FIXME: why is LNM commented out? + */ + public resetMode(params: IParams): void { + for (let i = 0; i < params.length; i++) { + switch (params.params[i]) { + case 4: + this._terminal.insertMode = false; + break; + case 20: + // this._t.convertEol = false; + break; + } + } + } + + /** * CSI ? Pm l * DEC Private Mode Reset (DECRST). * Ps = 1 -> Normal Cursor Keys (DECCKM). @@ -1780,25 +1842,34 @@ 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. * - * @vt: partly CSI RM "Reset Mode" "CSI Pm l" "Set various terminal attributes." - * TODO: Describe all supported attributes. - */ - public resetMode(params: IParams): void { - for (let i = 0; i < params.length; i++) { - switch (params.params[i]) { - case 4: - this._terminal.insertMode = false; - break; - case 20: - // this._t.convertEol = false; - break; - } - } - } - - /** * @vt: partly CSI DECRST "DEC Private Reset Mode" "CSI ? Pm l" "Reset various terminal attributes." - * TODO: Describe all supported attributes. + * Supported param values by DECRST: + * | param | Action | Status | + * | ----- | ------------------------------------------------------- | ----------- | + * | 1 | Normal Cursor Keys (DECCKM). | supported | + * | 2 | Designate VT52 mode (DECANM). | unsupported | + * | 3 | 80 Column Mode (DECCOLM). | broken | + * | 6 | Normal Cursor Mode (DECOM). | supported | + * | 7 | No Wraparound Mode (DECAWM). | supported | + * | 8 | No Auto-repeat Keys (DECARM). | unsupported | + * | 9 | Don't send Mouse X & Y on button press. | supported | + * | 12 | Stop Blinking Cursor. | supported | + * | 25 | Hide Cursor (DECTCEM). | supported | + * | 47 | Use Normal Screen Buffer. | supported | + * | 66 | Numeric keypad (DECNKM). | supported | + * | 1000 | Don't send Mouse reports. | supported | + * | 1002 | Don't use Cell Motion Mouse Tracking. | supported | + * | 1003 | Don't use All Motion Mouse Tracking. | supported | + * | 1004 | Don't send FocusIn/FocusOut events. | supported | + * | 1005 | Disable UTF-8 Mouse Mode. | unsupported | + * | 1006 | Disable SGR Mouse Mode. | supported | + * | 1015 | Disable urxvt Mouse Mode. | unsupported | + * | 1047 | Use Normal Screen Buffer (clearing screen if in alt). | supported | + * | 1048 | Restore cursor as in DECRC. | supported | + * | 1049 | Use Normal Screen Buffer and restore cursor. | supported | + * | 2004 | Reset bracketed paste mode. | supported | + * + * FIXME: DECCOLM is currently broken (already fixed in window options PR) */ public resetModePrivate(params: IParams): void { for (let i = 0; i < params.length; i++) { @@ -1949,71 +2020,67 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Pm m Character Attributes (SGR). - * Ps = 0 -> Normal (default). - * Ps = 1 -> Bold. - * Ps = 2 -> Faint, decreased intensity (ISO 6429). - * Ps = 4 -> Underlined. - * Ps = 5 -> Blink (appears as Bold). - * Ps = 7 -> Inverse. - * Ps = 8 -> Invisible, i.e., hidden (VT300). - * Ps = 2 2 -> Normal (neither bold nor faint). - * Ps = 2 4 -> Not underlined. - * Ps = 2 5 -> Steady (not blinking). - * Ps = 2 7 -> Positive (not inverse). - * Ps = 2 8 -> Visible, i.e., not hidden (VT300). - * Ps = 3 0 -> Set foreground color to Black. - * Ps = 3 1 -> Set foreground color to Red. - * Ps = 3 2 -> Set foreground color to Green. - * Ps = 3 3 -> Set foreground color to Yellow. - * Ps = 3 4 -> Set foreground color to Blue. - * Ps = 3 5 -> Set foreground color to Magenta. - * Ps = 3 6 -> Set foreground color to Cyan. - * Ps = 3 7 -> Set foreground color to White. - * Ps = 3 9 -> Set foreground color to default (original). - * Ps = 4 0 -> Set background color to Black. - * Ps = 4 1 -> Set background color to Red. - * Ps = 4 2 -> Set background color to Green. - * Ps = 4 3 -> Set background color to Yellow. - * Ps = 4 4 -> Set background color to Blue. - * Ps = 4 5 -> Set background color to Magenta. - * Ps = 4 6 -> Set background color to Cyan. - * Ps = 4 7 -> Set background color to White. - * Ps = 4 9 -> Set background color to default (original). - * - * If 16-color support is compiled, the following apply. Assume - * that xterm's resources are set so that the ISO color codes are - * the first 8 of a set of 16. Then the aixterm colors are the - * bright versions of the ISO colors: - * Ps = 9 0 -> Set foreground color to Black. - * Ps = 9 1 -> Set foreground color to Red. - * Ps = 9 2 -> Set foreground color to Green. - * Ps = 9 3 -> Set foreground color to Yellow. - * Ps = 9 4 -> Set foreground color to Blue. - * Ps = 9 5 -> Set foreground color to Magenta. - * Ps = 9 6 -> Set foreground color to Cyan. - * Ps = 9 7 -> Set foreground color to White. - * Ps = 1 0 0 -> Set background color to Black. - * Ps = 1 0 1 -> Set background color to Red. - * Ps = 1 0 2 -> Set background color to Green. - * Ps = 1 0 3 -> Set background color to Yellow. - * Ps = 1 0 4 -> Set background color to Blue. - * Ps = 1 0 5 -> Set background color to Magenta. - * Ps = 1 0 6 -> Set background color to Cyan. - * Ps = 1 0 7 -> Set background color to White. - * - * If xterm is compiled with the 16-color support disabled, it - * supports the following, from rxvt: - * Ps = 1 0 0 -> Set foreground and background color to - * default. - * - * If 88- or 256-color support is compiled, the following apply. - * Ps = 3 8 ; 5 ; Ps -> Set foreground color to the second - * Ps. - * Ps = 4 8 ; 5 ; Ps -> Set background color to the second - * Ps. * * @vt: partly CSI SGR "Select Graphic Rendition" "CSI Pm m" "Set/Reset various text attributes." - * Detailed description goes here... + * SGR selects one or more character attributes at the same time. Multiple params (up to 32) + * are applied from in order from left to right. The changed attributes are applied to all new + * characters received. If you move characters in the viewport by scrolling or any other means, + * then the attributes move with the characters. + * Supported param values by SGR: + * | Param | Meaning | Status | + * | --------- | -------------------------------------------------------- | ----------- | + * | 0 | Normal (default). Resets any other preceding SGR. | supported | + * | 1 | Bold. (also see `options.drawBoldTextInBrightColors`) | supported | + * | 2 | Faint, decreased intensity. | supported | + * | 3 | Italic. | supported | + * | 4 | Underlined. (no support for newer underline styles) | supported | + * | 5 | Slowly blinking. | unsupported | + * | 6 | Rapidly blinking. | unsupported | + * | 7 | Inverse. Flips foreground and background color. | supported | + * | 8 | Invisible (hidden). | supported | + * | 9 | Crossed-out characters. | unsupported | + * | 21 | Doubly underlined. | unsupported | + * | 22 | Normal (neither bold nor faint). | supported | + * | 23 | No italic. | supported | + * | 24 | Not underlined. | supported | + * | 25 | Steady (not blinking). | supported | + * | 27 | Positive (not inverse). | supported | + * | 28 | Visible (not hidden). | supported | + * | 29 | Not Crossed-out. | unsupported | + * | 30 | Foreground color: Black. | supported | + * | 31 | Foreground color: Red. | supported | + * | 32 | Foreground color: Green. | supported | + * | 33 | Foreground color: Yellow. | supported | + * | 34 | Foreground color: Blue. | supported | + * | 35 | Foreground color: Magenta. | supported | + * | 36 | Foreground color: Cyan. | supported | + * | 37 | Foreground color: White. | supported | + * | 38 | Foreground color: Extended color (see below). | supported | + * | 39 | Foreground color: Default (original). | supported | + * | 40 | Background color: Black. | supported | + * | 41 | Background color: Red. | supported | + * | 42 | Background color: Green. | supported | + * | 43 | Background color: Yellow. | supported | + * | 44 | Background color: Blue. | supported | + * | 45 | Background color: Magenta. | supported | + * | 46 | Background color: Cyan. | supported | + * | 47 | Background color: White. | supported | + * | 48 | Background color: Extended color (see below). | supported | + * | 49 | Background color: Default (original). | supported | + * | 90 - 97 | Bright foreground color (analogous to 30 -37). | supported | + * | 100 - 107 | Bright background color (analogous to 40 -47). | supported | + * Extended colors are supported for foreground (Ps=38) and background (Ps=48) as follows: + * | Ps + 1 | Meaning | Status | + * | ------ | ----------------------------------------------------------------------- | ----------- | + * | 0 | Implementation defined. | unsupported | + * | 1 | Transparent. | unsupported | + * | 2 | RGB color, in the form `Ps ; 2 ; R ; G ; B` or `Ps : 2 : : R : G : B`. | supported | + * | 3 | CMY color. | unsupported | + * | 4 | CMYK color. | unsupported | + * | 5 | Indexed (256 colors), in the form `Ps ; 5 ; INDEX` or `Ps : 5 : INDEX`. | supported | + * + * FIXME: blinking is implemented in attrs, but not working in renderers? + * FIXME: remove dead branch for p=100 */ public charAttributes(params: IParams): void { // Optimize a single SGR0. @@ -2101,7 +2168,7 @@ export class InputHandler extends Disposable implements IInputHandler { } else if (p === 38 || p === 48) { // fg color 256 and RGB i += this._extractColor(params, i, attr); - } else if (p === 100) { + } else if (p === 100) { // FIXME: dead branch, p=100 already handled above! // reset fg/bg attr.fg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK); attr.fg |= DEFAULT_ATTR_DATA.fg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK); @@ -2222,7 +2289,7 @@ export class InputHandler extends Disposable implements IInputHandler { * 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 `ITerminalOptions.cursorBlink`): + * Supported cursor styles: * - empty, 0 or 1: steady block * - 2: blink block * - 3: steady underline From 12b912140bf3ea05c05785d79db2365c429004ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Thu, 9 Jan 2020 16:40:35 +0100 Subject: [PATCH 15/21] use 2 empty lines as end of vt definition --- bin/extract_vtfeatures.js | 20 +++++++++++-- src/InputHandler.ts | 59 ++++++++++++++++++++++++++++----------- 2 files changed, 59 insertions(+), 20 deletions(-) diff --git a/bin/extract_vtfeatures.js b/bin/extract_vtfeatures.js index de91dca5..c0c70fbb 100644 --- a/bin/extract_vtfeatures.js +++ b/bin/extract_vtfeatures.js @@ -233,6 +233,10 @@ function createAnchorSlug(s) { return s.toLowerCase().split(' ').join('-'); } +function empty(ar) { + return !ar.filter(Boolean, ar).length; +} + function* parseMultiLineGen(filename, s) { if (!~s.indexOf('@vt:')) { return; @@ -241,29 +245,34 @@ function* parseMultiLineGen(filename, s) { let grabLine = false; let longDescription = []; let feature = undefined; + let noLineCount = 0; for (const line of lines) { if (grabLine) { - if (!line) { + if (!line) noLineCount++; + if (noLineCount >= 2) { if (feature) { - feature.longDescription = longDescription; + feature.longDescription = empty(longDescription) ? [] : longDescription; feature.longTarget = createAnchorSlug(feature.name); yield feature; } grabLine = false; longDescription = []; feature = undefined; + noLineCount = 0; } else if (line.indexOf('@vt:') === 0) { if (feature) { - feature.longDescription = []; + feature.longDescription = empty(longDescription) ? [] : longDescription; feature.longTarget = createAnchorSlug(feature.name); yield feature; } grabLine = true; longDescription = []; feature = undefined; + noLineCount = 0; } else { longDescription.push(line); + if (line) noLineCount = 0; } } if (line.indexOf('@vt:') === 0) { @@ -271,6 +280,11 @@ function* parseMultiLineGen(filename, s) { grabLine = true; } } + if (grabLine && feature) { + feature.longDescription = empty(longDescription) ? [] : longDescription; + feature.longTarget = createAnchorSlug(feature.name); + yield feature; + } } function parseSingleLine(filename, s) { diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 16a19d95..614753d6 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -68,16 +68,19 @@ const MAX_PARSEBUFFER_LENGTH = 131072; * * @vt: partly DCS DECRQSS "Request Selection or Setting" "DCS $ q Pt ST" "Request several terminal settings." * Response is in the form `ESC P 1 $ r Pt ST` for valid requests, where `Pt` contains the corresponding CSI string, - * `ESC P 0 ST` for invalid requests.\ + * `ESC P 0 ST` for invalid requests. + * * Supported requests and responses: - * | Type | Request | Response (`Pt`) | - * | -------------------------------- | ----------------- | ------------------ | - * | Graphic Rendition (SGR) | `DCS $ q m ST` | always reporting `0m` (currently broken) | - * | Top and Bottom Margins (DECSTBM) | `DCS $ q r ST` | `Ptop ; Pbottom r` | - * | Cursor Style (DECSCUSR) | `DCS $ q SP q ST` | `Pstyle SP q` | - * | Protection Attribute (DECSCA) | `DCS $ q " q ST` | always reporting `0 " q` (DECSCA is unsupported) | + * + * | Type | Request | Response (`Pt`) | + * | -------------------------------- | ----------------- | ----------------------------------------------------- | + * | Graphic Rendition (SGR) | `DCS $ q m ST` | always reporting `0m` (currently broken) | + * | Top and Bottom Margins (DECSTBM) | `DCS $ q r ST` | `Ps ; Ps r` | + * | Cursor Style (DECSCUSR) | `DCS $ q SP q ST` | `Ps SP q` | + * | Protection Attribute (DECSCA) | `DCS $ q " q ST` | always reporting `0 " q` (DECSCA is unsupported) | * | Conformance Level (DECSCL) | `DCS $ q " p ST` | always reporting `61 ; 1 " p` (DECSCL is unsupported) | * + * * TODO: * - fix SGR report * - either implement DECSCA or remove the report @@ -1002,6 +1005,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * @vt: supported CSI ED "Erase In Display" "CSI Ps J" "Erase various parts of the viewport." * Supported param values: + * * | Ps | Effect | * | -- | ------------------------------------------------------------ | * | 0 | Erase from the cursor through the end of the viewport. | @@ -1073,6 +1077,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * @vt: supported CSI EL "Erase In Line" "CSI Ps K" "Erase various parts of the active row." * Supported param values: + * * | Ps | Effect | * | -- | -------------------------------------------------------- | * | 0 | Erase from the cursor through the end of the row. | @@ -1176,6 +1181,7 @@ export class InputHandler extends Disposable implements IInputHandler { * The ICH sequence inserts `Ps` blank characters. The cursor remains at the beginning of the blank characters. * Text between the cursor and right margin moves to the right. Characters moved past the right margin are lost. * + * * FIXME: check against xterm - should not work outside of scroll margins (see VT520 manual) */ public insertChars(params: IParams): void { @@ -1200,6 +1206,7 @@ export class InputHandler extends Disposable implements IInputHandler { * As characters are deleted, the remaining characters between the cursor and right margin move to the left. * Character attributes move with the characters. The terminal adds blank characters at the right margin. * + * * FIXME: check against xterm - should not work outside of scroll margins (see VT520 manual) */ public deleteChars(params: IParams): void { @@ -1221,6 +1228,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * @vt: supported CSI SU "Scroll Up" "CSI Ps S" "Scroll `Ps` lines up (default=1)." * + * * FIXME: scrolled out lines at top = 1 should add to scrollback (xterm) */ public scrollUp(params: IParams): void { @@ -1411,7 +1419,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * @vt: supported CSI REP "Repeat Preceding Character" "CSI Ps b" "Repeat preceding character `Ps` times (default=1)." * REP repeats the previous character `Ps` times advancing the cursor, also wrapping if DECAWM is set. - * REP no effect if the sequence does not follow a printable ASCII character + * REP has no effect if the sequence does not follow a printable ASCII character * (NOOP for any other sequence in between or NON ASCII characters). */ public repeatPrecedingCharacter(params: IParams): void { @@ -1449,6 +1457,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * @vt: supported CSI DA1 "Primary Device Attributes" "CSI c" "Send primary device attributes." * + * * TODO: fix and cleanup response */ public sendDeviceAttributesPrimary(params: IParams): void { @@ -1483,6 +1492,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * @vt: supported CSI DA2 "Secondary Device Attributes" "CSI > c" "Send primary device attributes." * + * * TODO: fix and cleanup response */ public sendDeviceAttributesSecondary(params: IParams): void { @@ -1514,6 +1524,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * @vt: partly CSI SM "Set Mode" "CSI Pm h" "Set various terminal modes." * Supported param values by SM: + * * | Param | Action | Status | * | ----- | -------------------------------------- | ----------- | * | 2 | Keyboard Action Mode (KAM). Always on. | unsupported | @@ -1521,6 +1532,7 @@ export class InputHandler extends Disposable implements IInputHandler { * | 12 | Send/receive (SRM). Always off. | unsupported | * | 20 | Automatic Newline (LNM). Always off. | unsupported | * + * * FIXME: why is LNM commented out? */ public setMode(params: IParams): void { @@ -1619,6 +1631,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * @vt: partly CSI DECSET "DEC Private Set Mode" "CSI ? Pm h" "Set various terminal attributes." * Supported param values by DECSET: + * * | param | Action | Status | * | ----- | ------------------------------------------------------- | ----------- | * | 1 | Application Cursor Keys (DECCKM). | supported | @@ -1644,6 +1657,7 @@ export class InputHandler extends Disposable implements IInputHandler { * | 1049 | Save cursor and switch to alternate buffer clearing it. | partly | * | 2004 | Set bracketed paste mode. | supported | * + * * FIXME: implement DECSCNM, 1049 should clear altbuffer */ public setModePrivate(params: IParams): void { @@ -1743,6 +1757,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * @vt: partly CSI RM "Reset Mode" "CSI Pm l" "Set various terminal attributes." * Supported param values by RM: + * * | Param | Action | Status | * | ----- | -------------------------------------- | ----------- | * | 2 | Keyboard Action Mode (KAM). Always on. | unsupported | @@ -1750,6 +1765,7 @@ export class InputHandler extends Disposable implements IInputHandler { * | 12 | Send/receive (SRM). Always off. | unsupported | * | 20 | Normal Linefeed (LNM). Always off. | unsupported | * + * * FIXME: why is LNM commented out? */ public resetMode(params: IParams): void { @@ -1844,6 +1860,7 @@ export class InputHandler extends Disposable implements IInputHandler { * * @vt: partly CSI DECRST "DEC Private Reset Mode" "CSI ? Pm l" "Reset various terminal attributes." * Supported param values by DECRST: + * * | param | Action | Status | * | ----- | ------------------------------------------------------- | ----------- | * | 1 | Normal Cursor Keys (DECCKM). | supported | @@ -1869,6 +1886,7 @@ export class InputHandler extends Disposable implements IInputHandler { * | 1049 | Use Normal Screen Buffer and restore cursor. | supported | * | 2004 | Reset bracketed paste mode. | supported | * + * * FIXME: DECCOLM is currently broken (already fixed in window options PR) */ public resetModePrivate(params: IParams): void { @@ -2026,7 +2044,9 @@ export class InputHandler extends Disposable implements IInputHandler { * are applied from in order from left to right. The changed attributes are applied to all new * characters received. If you move characters in the viewport by scrolling or any other means, * then the attributes move with the characters. + * * Supported param values by SGR: + * * | Param | Meaning | Status | * | --------- | -------------------------------------------------------- | ----------- | * | 0 | Normal (default). Resets any other preceding SGR. | supported | @@ -2069,15 +2089,18 @@ export class InputHandler extends Disposable implements IInputHandler { * | 49 | Background color: Default (original). | supported | * | 90 - 97 | Bright foreground color (analogous to 30 -37). | supported | * | 100 - 107 | Bright background color (analogous to 40 -47). | supported | + * * Extended colors are supported for foreground (Ps=38) and background (Ps=48) as follows: - * | Ps + 1 | Meaning | Status | - * | ------ | ----------------------------------------------------------------------- | ----------- | - * | 0 | Implementation defined. | unsupported | - * | 1 | Transparent. | unsupported | - * | 2 | RGB color, in the form `Ps ; 2 ; R ; G ; B` or `Ps : 2 : : R : G : B`. | supported | - * | 3 | CMY color. | unsupported | - * | 4 | CMYK color. | unsupported | - * | 5 | Indexed (256 colors), in the form `Ps ; 5 ; INDEX` or `Ps : 5 : INDEX`. | supported | + * + * | Ps + 1 | Meaning | Status | + * | ------ | ------------------------------------------------------------- | ----------- | + * | 0 | Implementation defined. | unsupported | + * | 1 | Transparent. | unsupported | + * | 2 | RGB color as `Ps ; 2 ; R ; G ; B` or `Ps : 2 : : R : G : B`. | supported | + * | 3 | CMY color. | unsupported | + * | 4 | CMYK color. | unsupported | + * | 5 | Indexed (256 colors) as `Ps ; 5 ; INDEX` or `Ps : 5 : INDEX`. | supported | + * * * FIXME: blinking is implemented in attrs, but not working in renderers? * FIXME: remove dead branch for p=100 @@ -2257,13 +2280,15 @@ export class InputHandler extends Disposable implements IInputHandler { * @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: + * + * The following terminal attributes are reset to default values: * - cursor is reset (default = visible, home position) * - IRM is reset (dafault = false) * - scroll margins are reset (default = viewport size) * - erase attributes are reset to default * - charsets are reset * + * * FIXME: there are several more attributes missing (see VT520 manual) */ public softReset(params: IParams): void { From f9fddfc43d9f116f9cebd73ff124587218bf9049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Thu, 9 Jan 2020 18:47:56 +0100 Subject: [PATCH 16/21] fix table sorting --- bin/extract_vtfeatures.js | 33 +++++++++++++++++++++++---------- src/InputHandler.ts | 30 ++++++++++++++++-------------- 2 files changed, 39 insertions(+), 24 deletions(-) diff --git a/bin/extract_vtfeatures.js b/bin/extract_vtfeatures.js index c0c70fbb..a4ea3788 100644 --- a/bin/extract_vtfeatures.js +++ b/bin/extract_vtfeatures.js @@ -33,15 +33,6 @@ const TYPES = [ ]; const MARKDOWN_TMPL = ` - -### TODO -- improve table sorting: - - sort C0/C1 in byte order - - sort OSC in numerical order - - sort CSI/ESC/DCS in final byte order -- references - - xterm.js version: {{version}} ### Table of Contents @@ -209,6 +200,8 @@ To denote the sequences the following tables use the same abbreviations as xterm {{#OSC.length}} ### OSC +**Note**: Other than listed in the table, the parser recognizes both ST (ECMA-48) and BEL (xterm) as OSC sequence finalizer. + | Identifier | Sequence | Short Description | Status | | ---------- | -------- | ----------------- | ------ | {{#OSC}} @@ -308,6 +301,26 @@ function parseSingleLine(filename, s) { } } +function getSorter(entry) { + switch (entry) { + case 'C0': + case 'C1': + // NOTE: expects hex value notation at last position in sequence + return (a, b) => parseInt(a.sequence.slice(-2), 16) - parseInt(b.sequence.slice(-2), 16); + case 'OSC': + // NOTE: expects the decimal function identifier in mnemonic + return (a, b) => parseInt(a.mnemonic) - parseInt(b.mnemonic); + case 'DCS': + return (a, b) => a.mnemonic > b.mnemonic; + case 'CSI': + case 'ESC': + // default sort order by final byte + return (a, b) => a.sequence.charCodeAt(a.sequence.length - 1) - b.sequence.charCodeAt(b.sequence.length - 1); + default: + return (a, b) => a.sequence > b.sequence; + } +}; + function postProcessData(features) { const featureTable = {}; for (const feature of features) { @@ -320,7 +333,7 @@ function postProcessData(features) { } } for (const entry in featureTable) { - featureTable[entry].sort((a, b) => a.sequence.slice(-1) > b.sequence.slice(-1)); + featureTable[entry].sort(getSorter(entry)); } // console.error(featureTable); featureTable.version = require('../package.json').version; diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 614753d6..5a5e7db3 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -37,12 +37,14 @@ const GLEVEL: {[key: string]: number} = {'(': 0, ')': 1, '*': 2, '+': 3, '-': 1, // @vt: supported ESC ST "String Terminator" "ESC \" "Terminator used for string type sequences." // @vt: supported ESC PM "Privacy Message" "ESC ^" "Start of a privacy message." // @vt: supported ESC APC "Application Program Command" "ESC _" "Start of an APC sequence." -// @vt: supported C1 CSI "Control Sequence Introducer" "\x9b" "Start of a CSI sequence." -// @vt: supported C1 OSC "Operating System Command" "\x9d" "Start of an OSC sequence." +// @vt: supported C1 CSI "Control Sequence Introducer" "\x9B" "Start of a CSI sequence." +// @vt: supported C1 OSC "Operating System Command" "\x9D" "Start of an OSC sequence." // @vt: supported C1 DCS "Device Control String" "\x90" "Start of a DCS sequence." -// @vt: supported C1 ST "String Terminator" "\x9c" "Terminator used for string type sequences." -// @vt: supported C1 PM "Privacy Message" "\x9e" "Start of a privacy message." -// @vt: supported C1 APC "Application Program Command" "\x9f" "Start of an APC sequence." +// @vt: supported C1 ST "String Terminator" "\x9C" "Terminator used for string type sequences." +// @vt: supported C1 PM "Privacy Message" "\x9E" "Start of a privacy message." +// @vt: supported C1 APC "Application Program Command" "\x9F" "Start of an APC sequence." +// @vt: supported C0 NUL "Null" "\0, \x00" "NUL is ignored." +// @vt: supported C0 ESC "Escape" "\e, \x1B" "Start of a sequence. Cancels any other sequence." /** * Document common VT features here that are currently unsupported @@ -602,7 +604,7 @@ export class InputHandler extends Disposable implements IInputHandler { * BEL * Bell (Ctrl-G). * - * @vt: supported C0 BEL "Bell" "\a" "Ring the bell." + * @vt: supported C0 BEL "Bell" "\a, \x07" "Ring the bell." * The behavior of the bell is further customizable with `ITerminalOptions.bellStyle` * and `ITerminalOptions.bellSound`. */ @@ -614,11 +616,11 @@ export class InputHandler extends Disposable implements IInputHandler { * LF * 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 LF "Line Feed" "\n, \x0A" "Move the cursor one row down, scrolling if needed." * Scrolling is restricted to scroll margins and will only happen on the bottom line. * - * @vt: supported C0 VT "Vertical Tabulation" "\v" "Treated as LF." - * @vt: supported C0 FF "Form Feed" "\f" "Treated as LF." + * @vt: supported C0 VT "Vertical Tabulation" "\v, \x0B" "Treated as LF." + * @vt: supported C0 FF "Form Feed" "\f, \x0C" "Treated as LF." */ public lineFeed(): void { // make buffer local for faster access @@ -648,7 +650,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CR * Carriage Return (Ctrl-M). * - * @vt: supported C0 CR "Carriage Return" "\r" "Move the cursor to the beginning of the row." + * @vt: supported C0 CR "Carriage Return" "\r, \x0D" "Move the cursor to the beginning of the row." */ public carriageReturn(): void { this._bufferService.buffer.x = 0; @@ -658,7 +660,7 @@ export class InputHandler extends Disposable implements IInputHandler { * BS * Backspace (Ctrl-H). * - * @vt: supported C0 BS "Backspace" "\b" "Move the cursor one position to the left." + * @vt: supported C0 BS "Backspace" "\b, \x08" "Move the cursor one position to the left." */ public backspace(): void { this._restrictCursor(); @@ -671,7 +673,7 @@ export class InputHandler extends Disposable implements IInputHandler { * TAB * Horizontal Tab (HT) (Ctrl-I). * - * @vt: supported C0 HT "Horizontal Tabulation" "\t" "Move the cursor to the next character tab stop." + * @vt: supported C0 HT "Horizontal Tabulation" "\t, \x09" "Move the cursor to the next character tab stop." */ public tab(): void { if (this._bufferService.buffer.x >= this._bufferService.cols) { @@ -689,7 +691,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Shift Out (Ctrl-N) -> Switch to Alternate Character Set. This invokes the * G1 character set. * - * @vt: partly C0 SO "Shift Out" "\x0e" "Switch to an alternative character set." + * @vt: partly C0 SO "Shift Out" "\x0E" "Switch to an alternative character set." */ public shiftOut(): void { this._charsetService.setgLevel(1); @@ -700,7 +702,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Shift In (Ctrl-O) -> Switch to Standard Character Set. This invokes the G0 * character set (the default). * - * @vt: supported C0 SI "Shift In" "\x0f" "Return to regular character set after Shift Out." + * @vt: supported C0 SI "Shift In" "\x0F" "Return to regular character set after Shift Out." */ public shiftIn(): void { this._charsetService.setgLevel(0); From 2d1af70e87fe0b27f81df2c188fdcaf5ea14ec9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Thu, 9 Jan 2020 20:40:18 +0100 Subject: [PATCH 17/21] lower header level; fix wrongly escaped sequences --- bin/extract_vtfeatures.js | 53 ++++++++++++++++++++++----------------- src/InputHandler.ts | 2 +- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/bin/extract_vtfeatures.js b/bin/extract_vtfeatures.js index a4ea3788..75e27ed2 100644 --- a/bin/extract_vtfeatures.js +++ b/bin/extract_vtfeatures.js @@ -35,7 +35,7 @@ const TYPES = [ const MARKDOWN_TMPL = ` xterm.js version: {{version}} -### Table of Contents +## Table of Contents - [General notes](#general-notes) {{#C0.length}} @@ -57,16 +57,16 @@ xterm.js version: {{version}} - [OSC](#osc) {{/OSC.length}} -### General notes +## General notes -This document lists xterm.js' support of terminal sequences. The sequences are grouped by their type: +This document lists xterm.js' support of terminal sequences. The sequences are grouped by their sequence type: -- C0: single byte command (7bit control characters, byte range \\x00 .. \\x1f) -- C1: single byte command (8bit control characters, byte range \\x80 .. \\x9f) -- ESC: sequence starting with \`ESC\` (\`\\x1b\`) -- CSI - Control Sequence Introducer: sequence starting with \`ESC [\` (7bit) or CSI (\`\\x9b\` 8bit) +- C0: single byte command (7bit control codes, byte range \\x00 .. \\x1F, \x7F) +- C1: single byte command (8bit control codes, byte range \\x80 .. \\x9F) +- ESC: sequence starting with \`ESC\` (\`\\x1B\`) +- CSI - Control Sequence Introducer: sequence starting with \`ESC [\` (7bit) or CSI (\`\\x9B\` 8bit) - DCS - Device Control String: sequence starting with \`ESC P\` (7bit) or DCS (\`\\x90\` 8bit) -- OSC - Operating System Command: sequence starting with \`ESC ]\` (7bit) or OSC (\`\\x9d\` 8bit) +- OSC - Operating System Command: sequence starting with \`ESC ]\` (7bit) or OSC (\`\\x9D\` 8bit) Application Program Command (APC), Privacy Message (PM) and Start of String (SOS) are recognized but not supported, any sequence of these types will be ignored. They are also not hookable by the API. @@ -74,7 +74,7 @@ any sequence of these types will be ignored. They are also not hookable by the A Note that the list only contains sequences implemented in xterm.js' core codebase. Missing sequences are either not supported or unstable/experimental. Furthermore addons or integrations can provide additional custom sequences. -To denote the sequences the following tables use the same abbreviations as xterm does: +To denote the sequences the tables use the same abbreviations as xterm does: - \`Ps\`: A single (usually optional) numeric parameter, composed of one or more decimal digits. - \`Pm\`: A multiple numeric parameter composed of any number of single numeric parameters, separated by ; character(s), e.g. \` Ps ; Ps ; ... \`. @@ -83,7 +83,7 @@ To denote the sequences the following tables use the same abbreviations as xterm {{#C0.length}} -### C0 +## C0 | Mnemonic | Name | Sequence | Short Description | Status | | -------- | ---- | -------- | ----------------- | ------ | @@ -94,7 +94,7 @@ To denote the sequences the following tables use the same abbreviations as xterm {{#C0.hasLongDescriptions}} {{#C0}} {{#longDescription.length}} -#### {{name}} +### {{name}} {{#longDescription}} {{{.}}} {{/longDescription}} @@ -106,7 +106,7 @@ To denote the sequences the following tables use the same abbreviations as xterm {{#C1.length}} -### C1 +## C1 | Mnemonic | Name | Sequence | Short Description | Status | | -------- | ---- | -------- | ----------------- | ------ | @@ -117,7 +117,7 @@ To denote the sequences the following tables use the same abbreviations as xterm {{#C1.hasLongDescriptions}} {{#C1}} {{#longDescription.length}} -#### {{name}} +### {{name}} {{#longDescription}} {{{.}}} {{/longDescription}} @@ -129,18 +129,18 @@ To denote the sequences the following tables use the same abbreviations as xterm {{#CSI.length}} -### CSI +## CSI | Mnemonic | Name | Sequence | Short Description | Status | | -------- | ---- | -------- | ----------------- | ------ | {{#CSI}} -| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{status}} | +| {{mnemonic}} | {{name}} | \`\`{{{sequence}}}\`\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{status}} | {{/CSI}} {{#CSI.hasLongDescriptions}} {{#CSI}} {{#longDescription.length}} -#### {{name}} +### {{name}} {{#longDescription}} {{{.}}} {{/longDescription}} @@ -152,7 +152,7 @@ To denote the sequences the following tables use the same abbreviations as xterm {{#DCS.length}} -### DCS +## DCS | Mnemonic | Name | Sequence | Short Description | Status | | -------- | ---- | -------- | ----------------- | ------ | @@ -163,7 +163,7 @@ To denote the sequences the following tables use the same abbreviations as xterm {{#DCS.hasLongDescriptions}} {{#DCS}} {{#longDescription.length}} -#### {{name}} +### {{name}} {{#longDescription}} {{{.}}} {{/longDescription}} @@ -175,7 +175,7 @@ To denote the sequences the following tables use the same abbreviations as xterm {{#ESC.length}} -### ESC +## ESC | Mnemonic | Name | Sequence | Short Description | Status | | -------- | ---- | -------- | ----------------- | ------ | @@ -186,7 +186,7 @@ To denote the sequences the following tables use the same abbreviations as xterm {{#ESC.hasLongDescriptions}} {{#ESC}} {{#longDescription.length}} -#### {{name}} +### {{name}} {{#longDescription}} {{{.}}} {{/longDescription}} @@ -198,7 +198,7 @@ To denote the sequences the following tables use the same abbreviations as xterm {{#OSC.length}} -### OSC +## OSC **Note**: Other than listed in the table, the parser recognizes both ST (ECMA-48) and BEL (xterm) as OSC sequence finalizer. @@ -211,7 +211,7 @@ To denote the sequences the following tables use the same abbreviations as xterm {{#OSC.hasLongDescriptions}} {{#OSC}} {{#longDescription.length}} -#### {{name}} +### {{name}} {{#longDescription}} {{{.}}} {{/longDescription}} @@ -315,7 +315,14 @@ function getSorter(entry) { case 'CSI': case 'ESC': // default sort order by final byte - return (a, b) => a.sequence.charCodeAt(a.sequence.length - 1) - b.sequence.charCodeAt(b.sequence.length - 1); + return (a, b) => { + // ugly hack to fix sorting of workaround in HPA sequence "CSI Ps ` " + // for HPA compare with length - 2 instead + const HPA = 'CSI Ps ` '; + const aa = a.sequence === HPA ? a.sequence.slice(0, -1) : a.sequence; + const bb = b.sequence === HPA ? b.sequence.slice(0, -1) : b.sequence; + return aa.charCodeAt(aa.length - 1) - bb.charCodeAt(bb.length - 1); + }; default: return (a, b) => a.sequence > b.sequence; } diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 5a5e7db3..33b731a7 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -857,7 +857,7 @@ export class InputHandler extends Disposable implements IInputHandler { * [column] (default = [row,1]) (HPA). * Currently same functionality as CHA. * - * @vt: supported CSI HPA "Horizontal Position Absolute" "CSI Ps `" "Same as CHA." + * @vt: supported CSI HPA "Horizontal Position Absolute" "CSI Ps ` " "Same as CHA." */ public charPosAbsolute(params: IParams): void { this._setCursor((params.params[0] || 1) - 1, this._bufferService.buffer.y); From 4010900e47d154514fbd91eca41c8b7a0a8db84e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Thu, 9 Jan 2020 22:40:08 +0100 Subject: [PATCH 18/21] simply status column, reason in title --- bin/extract_vtfeatures.js | 81 +++++--- src/InputHandler.ts | 394 +++++++++++++++++++------------------- 2 files changed, 253 insertions(+), 222 deletions(-) diff --git a/bin/extract_vtfeatures.js b/bin/extract_vtfeatures.js index 75e27ed2..51630a62 100644 --- a/bin/extract_vtfeatures.js +++ b/bin/extract_vtfeatures.js @@ -17,7 +17,7 @@ const REX_COMMENTS = /^\s*?[/][*][*]([\s\S]*?)[*][/]|^\s*?\/\/ ([@]vt[:].*?)$/mu * regexp to parse the @vt line * expected data - "@vt: "" "" "" */ -const REX_VT_LINE = /^[@]vt\:\s*(\w+)\s*(\w+)\s*(\w+)\s*"(.*?)"\s*"(.*?)"\s*"(.*?)".*$/; +const REX_VT_LINE = /^[@]vt\:\s*(\w+|#\w+|#\w+\[.*?\])\s*(\w+)\s*(\w+)\s*"(.*?)"\s*"(.*?)"\s*"(.*?)".*$/; // known vt command types const TYPES = [ @@ -61,12 +61,12 @@ xterm.js version: {{version}} This document lists xterm.js' support of terminal sequences. The sequences are grouped by their sequence type: -- C0: single byte command (7bit control codes, byte range \\x00 .. \\x1F, \x7F) -- C1: single byte command (8bit control codes, byte range \\x80 .. \\x9F) +- C0: single byte command (7bit control codes, byte range \`\\x00\` .. \`\\x1F\`, \`\\x7F\`) +- C1: single byte command (8bit control codes, byte range \`\\x80\` .. \`\\x9F\`) - ESC: sequence starting with \`ESC\` (\`\\x1B\`) -- CSI - Control Sequence Introducer: sequence starting with \`ESC [\` (7bit) or CSI (\`\\x9B\` 8bit) -- DCS - Device Control String: sequence starting with \`ESC P\` (7bit) or DCS (\`\\x90\` 8bit) -- OSC - Operating System Command: sequence starting with \`ESC ]\` (7bit) or OSC (\`\\x9D\` 8bit) +- CSI - Control Sequence Introducer: sequence starting with \`ESC [\` (7bit) or CSI (\`\\x9B\`, 8bit) +- DCS - Device Control String: sequence starting with \`ESC P\` (7bit) or DCS (\`\\x90\`, 8bit) +- OSC - Operating System Command: sequence starting with \`ESC ]\` (7bit) or OSC (\`\\x9D\`, 8bit) Application Program Command (APC), Privacy Message (PM) and Start of String (SOS) are recognized but not supported, any sequence of these types will be ignored. They are also not hookable by the API. @@ -85,10 +85,10 @@ To denote the sequences the tables use the same abbreviations as xterm does: {{#C0.length}} ## C0 -| Mnemonic | Name | Sequence | Short Description | Status | -| -------- | ---- | -------- | ----------------- | ------ | +| Mnemonic | Name | Sequence | Short Description | Support | +| -------- | ---- | -------- | ----------------- | ------- | {{#C0}} -| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{status}} | +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{{status}}} | {{/C0}} {{#C0.hasLongDescriptions}} @@ -108,10 +108,10 @@ To denote the sequences the tables use the same abbreviations as xterm does: {{#C1.length}} ## C1 -| Mnemonic | Name | Sequence | Short Description | Status | -| -------- | ---- | -------- | ----------------- | ------ | +| Mnemonic | Name | Sequence | Short Description | Support | +| -------- | ---- | -------- | ----------------- | ------- | {{#C1}} -| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{status}} | +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{{status}}} | {{/C1}} {{#C1.hasLongDescriptions}} @@ -131,10 +131,10 @@ To denote the sequences the tables use the same abbreviations as xterm does: {{#CSI.length}} ## CSI -| Mnemonic | Name | Sequence | Short Description | Status | -| -------- | ---- | -------- | ----------------- | ------ | +| Mnemonic | Name | Sequence | Short Description | Support | +| -------- | ---- | -------- | ----------------- | ------- | {{#CSI}} -| {{mnemonic}} | {{name}} | \`\`{{{sequence}}}\`\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{status}} | +| {{mnemonic}} | {{name}} | \`\`{{{sequence}}}\`\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{{status}}} | {{/CSI}} {{#CSI.hasLongDescriptions}} @@ -154,10 +154,10 @@ To denote the sequences the tables use the same abbreviations as xterm does: {{#DCS.length}} ## DCS -| Mnemonic | Name | Sequence | Short Description | Status | -| -------- | ---- | -------- | ----------------- | ------ | +| Mnemonic | Name | Sequence | Short Description | Support | +| -------- | ---- | -------- | ----------------- | ------- | {{#DCS}} -| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{status}} | +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{{status}}} | {{/DCS}} {{#DCS.hasLongDescriptions}} @@ -177,10 +177,10 @@ To denote the sequences the tables use the same abbreviations as xterm does: {{#ESC.length}} ## ESC -| Mnemonic | Name | Sequence | Short Description | Status | -| -------- | ---- | -------- | ----------------- | ------ | +| Mnemonic | Name | Sequence | Short Description | Support | +| -------- | ---- | -------- | ----------------- | ------- | {{#ESC}} -| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{status}} | +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{{status}}} | {{/ESC}} {{#ESC.hasLongDescriptions}} @@ -202,10 +202,10 @@ To denote the sequences the tables use the same abbreviations as xterm does: **Note**: Other than listed in the table, the parser recognizes both ST (ECMA-48) and BEL (xterm) as OSC sequence finalizer. -| Identifier | Sequence | Short Description | Status | -| ---------- | -------- | ----------------- | ------ | +| Identifier | Sequence | Short Description | Support | +| ---------- | -------- | ----------------- | ------- | {{#OSC}} -| {{mnemonic}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{status}} | +| {{mnemonic}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{{status}}} | {{/OSC}} {{#OSC.hasLongDescriptions}} @@ -222,6 +222,34 @@ To denote the sequences the tables use the same abbreviations as xterm does: {{/OSC.length}} ` +// support status marcos +// applied for: +// - status field of single @vt line +// - all lines in long description +const MACRO = [ + // #Y - supported + [/#Y/g, s => ''], + // #N - unsupported + [/#N/g, s => ''], + // #P[reason] - partial support with a reason as title + [/#P\[(.*?)\]/g, (s, p1) => `Partial`], + // #B[reason] - supported but broken in a certain way, reason in title + [/#B\[(.*?)\]/g, (s, p1) => `Broken`] +]; + +function applyMacros(s) { + for (let i = 0; i < MACRO.length; ++i) { + s = s.replace(MACRO[i][0], MACRO[i][1]); + } + return s; +} + +function replaceStatus(s) { + if (s === 'supported') return ''; + if (s === 'unsupported') return ''; + return s; +} + function createAnchorSlug(s) { return s.toLowerCase().split(' ').join('-'); } @@ -264,7 +292,8 @@ function* parseMultiLineGen(filename, s) { feature = undefined; noLineCount = 0; } else { - longDescription.push(line); + //longDescription.push(line); + longDescription.push(applyMacros(line)); if (line) noLineCount = 0; } } @@ -331,6 +360,8 @@ function getSorter(entry) { function postProcessData(features) { const featureTable = {}; for (const feature of features) { + // feature.status = replaceStatus(feature.status); + feature.status = applyMacros(feature.status); if (featureTable[feature.type] === undefined) { featureTable[feature.type] = []; } diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 33b731a7..53056cd0 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -31,26 +31,26 @@ const GLEVEL: {[key: string]: number} = {'(': 0, ')': 1, '*': 2, '+': 3, '-': 1, /** * VT commands done by the parser - FIXME: move this to the parser? */ -// @vt: supported ESC CSI "Control Sequence Introducer" "ESC [" "Start of a CSI sequence." -// @vt: supported ESC OSC "Operating System Command" "ESC ]" "Start of an OSC sequence." -// @vt: supported ESC DCS "Device Control String" "ESC P" "Start of a DCS sequence." -// @vt: supported ESC ST "String Terminator" "ESC \" "Terminator used for string type sequences." -// @vt: supported ESC PM "Privacy Message" "ESC ^" "Start of a privacy message." -// @vt: supported ESC APC "Application Program Command" "ESC _" "Start of an APC sequence." -// @vt: supported C1 CSI "Control Sequence Introducer" "\x9B" "Start of a CSI sequence." -// @vt: supported C1 OSC "Operating System Command" "\x9D" "Start of an OSC sequence." -// @vt: supported C1 DCS "Device Control String" "\x90" "Start of a DCS sequence." -// @vt: supported C1 ST "String Terminator" "\x9C" "Terminator used for string type sequences." -// @vt: supported C1 PM "Privacy Message" "\x9E" "Start of a privacy message." -// @vt: supported C1 APC "Application Program Command" "\x9F" "Start of an APC sequence." -// @vt: supported C0 NUL "Null" "\0, \x00" "NUL is ignored." -// @vt: supported C0 ESC "Escape" "\e, \x1B" "Start of a sequence. Cancels any other sequence." +// @vt: #Y ESC CSI "Control Sequence Introducer" "ESC [" "Start of a CSI sequence." +// @vt: #Y ESC OSC "Operating System Command" "ESC ]" "Start of an OSC sequence." +// @vt: #Y ESC DCS "Device Control String" "ESC P" "Start of a DCS sequence." +// @vt: #Y ESC ST "String Terminator" "ESC \" "Terminator used for string type sequences." +// @vt: #Y ESC PM "Privacy Message" "ESC ^" "Start of a privacy message." +// @vt: #Y ESC APC "Application Program Command" "ESC _" "Start of an APC sequence." +// @vt: #Y C1 CSI "Control Sequence Introducer" "\x9B" "Start of a CSI sequence." +// @vt: #Y C1 OSC "Operating System Command" "\x9D" "Start of an OSC sequence." +// @vt: #Y C1 DCS "Device Control String" "\x90" "Start of a DCS sequence." +// @vt: #Y C1 ST "String Terminator" "\x9C" "Terminator used for string type sequences." +// @vt: #Y C1 PM "Privacy Message" "\x9E" "Start of a privacy message." +// @vt: #Y C1 APC "Application Program Command" "\x9F" "Start of an APC sequence." +// @vt: #Y C0 NUL "Null" "\0, \x00" "NUL is ignored." +// @vt: #Y C0 ESC "Escape" "\e, \x1B" "Start of a sequence. Cancels any other sequence." /** * 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 OSC 1 "Set Icon Name" "OSC 1 ; Pt BEL" "Set icon name." +// @vt: #N DCS SIXEL "SIXEL Graphics" "DCS Ps ; Ps ; Ps ; q Pt ST" "Draw SIXEL image starting at cursor position." +// @vt: #N 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. @@ -68,7 +68,7 @@ const MAX_PARSEBUFFER_LENGTH = 131072; * Request Status String (DECRQSS), VT420 and up. * Response: DECRPSS (https://vt100.net/docs/vt510-rm/DECRPSS.html) * - * @vt: partly DCS DECRQSS "Request Selection or Setting" "DCS $ q Pt ST" "Request several terminal settings." + * @vt: #P[See limited support below.] DCS DECRQSS "Request Selection or Setting" "DCS $ q Pt ST" "Request several terminal settings." * Response is in the form `ESC P 1 $ r Pt ST` for valid requests, where `Pt` contains the corresponding CSI string, * `ESC P 0 ST` for invalid requests. * @@ -145,7 +145,7 @@ class DECRQSS implements IDcsHandler { * DECUDK (https://vt100.net/docs/vt510-rm/DECUDK.html) * not supported * - * @vt: unsupported DCS DECUDK "User Defined Keys" "DCS Ps ; Ps | Pt ST" "Definitions for user-defined keys." + * @vt: #N DCS DECUDK "User Defined Keys" "DCS Ps ; Ps | Pt ST" "Definitions for user-defined keys." */ /** @@ -153,7 +153,7 @@ class DECRQSS implements IDcsHandler { * Request Terminfo String * not implemented * - * @vt: unsupported DCS XTGETTCAP "Request Terminfo String" "DCS + q Pt ST" "Request Terminfo String." + * @vt: #N DCS XTGETTCAP "Request Terminfo String" "DCS + q Pt ST" "Request Terminfo String." */ /** @@ -161,7 +161,7 @@ class DECRQSS implements IDcsHandler { * Set Terminfo Data * not supported * - * @vt: unsupported DCS XTSETTCAP "Set Terminfo Data" "DCS + p Pt ST" "Set Terminfo Data." + * @vt: #N DCS XTSETTCAP "Set Terminfo Data" "DCS + p Pt ST" "Set Terminfo Data." */ @@ -604,7 +604,7 @@ export class InputHandler extends Disposable implements IInputHandler { * BEL * Bell (Ctrl-G). * - * @vt: supported C0 BEL "Bell" "\a, \x07" "Ring the bell." + * @vt: #Y C0 BEL "Bell" "\a, \x07" "Ring the bell." * The behavior of the bell is further customizable with `ITerminalOptions.bellStyle` * and `ITerminalOptions.bellSound`. */ @@ -616,11 +616,11 @@ export class InputHandler extends Disposable implements IInputHandler { * LF * Line Feed or New Line (NL). (LF is Ctrl-J). * - * @vt: supported C0 LF "Line Feed" "\n, \x0A" "Move the cursor one row down, scrolling if needed." + * @vt: #Y C0 LF "Line Feed" "\n, \x0A" "Move the cursor one row down, scrolling if needed." * Scrolling is restricted to scroll margins and will only happen on the bottom line. * - * @vt: supported C0 VT "Vertical Tabulation" "\v, \x0B" "Treated as LF." - * @vt: supported C0 FF "Form Feed" "\f, \x0C" "Treated as LF." + * @vt: #Y C0 VT "Vertical Tabulation" "\v, \x0B" "Treated as LF." + * @vt: #Y C0 FF "Form Feed" "\f, \x0C" "Treated as LF." */ public lineFeed(): void { // make buffer local for faster access @@ -650,7 +650,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CR * Carriage Return (Ctrl-M). * - * @vt: supported C0 CR "Carriage Return" "\r, \x0D" "Move the cursor to the beginning of the row." + * @vt: #Y C0 CR "Carriage Return" "\r, \x0D" "Move the cursor to the beginning of the row." */ public carriageReturn(): void { this._bufferService.buffer.x = 0; @@ -660,7 +660,7 @@ export class InputHandler extends Disposable implements IInputHandler { * BS * Backspace (Ctrl-H). * - * @vt: supported C0 BS "Backspace" "\b, \x08" "Move the cursor one position to the left." + * @vt: #Y C0 BS "Backspace" "\b, \x08" "Move the cursor one position to the left." */ public backspace(): void { this._restrictCursor(); @@ -673,7 +673,7 @@ export class InputHandler extends Disposable implements IInputHandler { * TAB * Horizontal Tab (HT) (Ctrl-I). * - * @vt: supported C0 HT "Horizontal Tabulation" "\t, \x09" "Move the cursor to the next character tab stop." + * @vt: #Y C0 HT "Horizontal Tabulation" "\t, \x09" "Move the cursor to the next character tab stop." */ public tab(): void { if (this._bufferService.buffer.x >= this._bufferService.cols) { @@ -691,7 +691,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Shift Out (Ctrl-N) -> Switch to Alternate Character Set. This invokes the * G1 character set. * - * @vt: partly C0 SO "Shift Out" "\x0E" "Switch to an alternative character set." + * @vt: #P[Only limited ISO-2022 charset support.] C0 SO "Shift Out" "\x0E" "Switch to an alternative character set." */ public shiftOut(): void { this._charsetService.setgLevel(1); @@ -702,7 +702,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Shift In (Ctrl-O) -> Switch to Standard Character Set. This invokes the G0 * character set (the default). * - * @vt: supported C0 SI "Shift In" "\x0F" "Return to regular character set after Shift Out." + * @vt: #Y C0 SI "Shift In" "\x0F" "Return to regular character set after Shift Out." */ public shiftIn(): void { this._charsetService.setgLevel(0); @@ -749,7 +749,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps A * Cursor Up Ps Times (default = 1) (CUU). * - * @vt: supported CSI CUU "Cursor Up" "CSI Ps A" "Move cursor `Ps` times up (default=1)." + * @vt: #Y CSI CUU "Cursor Up" "CSI Ps A" "Move cursor `Ps` times up (default=1)." * If the cursor would pass the top scroll margin, it will stop there. */ public cursorUp(params: IParams): void { @@ -766,7 +766,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps B * Cursor Down Ps Times (default = 1) (CUD). * - * @vt: supported CSI CUD "Cursor Down" "CSI Ps B" "Move cursor `Ps` times down (default=1)." + * @vt: #Y CSI CUD "Cursor Down" "CSI Ps B" "Move cursor `Ps` times down (default=1)." * If the cursor would pass the bottom scroll margin, it will stop there. */ public cursorDown(params: IParams): void { @@ -783,7 +783,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps C * Cursor Forward Ps Times (default = 1) (CUF). * - * @vt: supported CSI CUF "Cursor Forward" "CSI Ps C" "Move cursor `Ps` times forward (default=1)." + * @vt: #Y CSI CUF "Cursor Forward" "CSI Ps C" "Move cursor `Ps` times forward (default=1)." */ public cursorForward(params: IParams): void { this._moveCursor(params.params[0] || 1, 0); @@ -793,7 +793,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps D * Cursor Backward Ps Times (default = 1) (CUB). * - * @vt: supported CSI CUB "Cursor Backward" "CSI Ps D" "Move cursor `Ps` times backward (default=1)." + * @vt: #Y CSI CUB "Cursor Backward" "CSI Ps D" "Move cursor `Ps` times backward (default=1)." */ public cursorBackward(params: IParams): void { this._moveCursor(-(params.params[0] || 1), 0); @@ -804,7 +804,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Cursor Next Line Ps Times (default = 1) (CNL). * 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." + * @vt: #Y CSI CNL "Cursor Next Line" "CSI Ps E" "Move cursor `Ps` times down (default=1) and to the first column." * Same as CUD, additionally places the cursor at the first column. */ public cursorNextLine(params: IParams): void { @@ -817,7 +817,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Cursor Previous Line Ps Times (default = 1) (CPL). * 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." + * @vt: #Y CSI CPL "Cursor Backward" "CSI Ps F" "Move cursor `Ps` times up (default=1) and to the first column." * Same as CUU, additionally places the cursor at the first column. */ public cursorPrecedingLine(params: IParams): void { @@ -829,7 +829,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps G * 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)." + * @vt: #Y 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 { this._setCursor((params.params[0] || 1) - 1, this._bufferService.buffer.y); @@ -839,7 +839,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps ; Ps H * 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])." + * @vt: #Y CSI CUP "Cursor Position" "CSI Ps ; Ps H" "Set cursor to position [`Ps`, `Ps`] (default = [1, 1])." * If ORIGIN mode is set, places the cursor to the absolute position within the scroll margins. * If ORIGIN mode is not set, places the cursor to the absolute position within the viewport. * Note that the coordinates are 1-based, thus the top left position starts at `1 ; 1`. @@ -857,7 +857,7 @@ export class InputHandler extends Disposable implements IInputHandler { * [column] (default = [row,1]) (HPA). * Currently same functionality as CHA. * - * @vt: supported CSI HPA "Horizontal Position Absolute" "CSI Ps ` " "Same as CHA." + * @vt: #Y CSI HPA "Horizontal Position Absolute" "CSI Ps ` " "Same as CHA." */ public charPosAbsolute(params: IParams): void { this._setCursor((params.params[0] || 1) - 1, this._bufferService.buffer.y); @@ -867,7 +867,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Pm a Character Position Relative * [columns] (default = [row,col+1]) (HPR) * - * @vt: supported CSI HPR "Horizontal Position Relative" "CSI Ps a" "Same as CUF." + * @vt: #Y CSI HPR "Horizontal Position Relative" "CSI Ps a" "Same as CUF." */ public hPositionRelative(params: IParams): void { this._moveCursor(params.params[0] || 1, 0); @@ -877,7 +877,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Pm d Vertical Position Absolute (VPA) * [row] (default = [1,column]) * - * @vt: supported CSI VPA "Vertical Position Absolute" "CSI Ps d" "Move cursor to `Ps`-th row (default=1)." + * @vt: #Y CSI VPA "Vertical Position Absolute" "CSI Ps d" "Move cursor to `Ps`-th row (default=1)." */ public linePosAbsolute(params: IParams): void { this._setCursor(this._bufferService.buffer.x, (params.params[0] || 1) - 1); @@ -888,7 +888,7 @@ export class InputHandler extends Disposable implements IInputHandler { * [rows] (default = [row+1,column]) * reuse CSI Ps B ? * - * @vt: supported CSI VPR "Vertical Position Relative" "CSI Ps e" "Move cursor `Ps` times down (default=1)." + * @vt: #Y CSI VPR "Vertical Position Relative" "CSI Ps e" "Move cursor `Ps` times down (default=1)." */ public vPositionRelative(params: IParams): void { this._moveCursor(0, params.params[0] || 1); @@ -900,7 +900,7 @@ export class InputHandler extends Disposable implements IInputHandler { * [1,1]) (HVP). * Same as CUP. * - * @vt: supported CSI HVP "Horizontal and Vertical Position" "CSI Ps ; Ps f" "Same as CUP." + * @vt: #Y CSI HVP "Horizontal and Vertical Position" "CSI Ps ; Ps f" "Same as CUP." */ public hVPosition(params: IParams): void { this.cursorPosition(params); @@ -914,7 +914,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 2 -> Clear Stops on Line. * 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)." + * @vt: #Y CSI TBC "Tab Clear" "CSI Ps g" "Clear tab stops at current position (0) or all (3) (default=0)." * Clearing tabstops off the active row (Ps = 2, VT100) is currently not supported. */ public tabClear(params: IParams): void { @@ -930,7 +930,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps I * 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)." + * @vt: #Y CSI CHT "Cursor Horizontal Tabulation" "CSI Ps I" "Move cursor `Ps` times tabs forward (default=1)." */ public cursorForwardTab(params: IParams): void { if (this._bufferService.buffer.x >= this._bufferService.cols) { @@ -945,7 +945,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * 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)." + * @vt: #Y CSI CBT "Cursor Backward Tabulation" "CSI Ps Z" "Move cursor `Ps` tabs backward (default=1)." */ public cursorBackwardTab(params: IParams): void { if (this._bufferService.buffer.x >= this._bufferService.cols) { @@ -1005,7 +1005,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 1 -> Selective Erase Above. * Ps = 2 -> Selective Erase All. * - * @vt: supported CSI ED "Erase In Display" "CSI Ps J" "Erase various parts of the viewport." + * @vt: #Y CSI ED "Erase In Display" "CSI Ps J" "Erase various parts of the viewport." * Supported param values: * * | Ps | Effect | @@ -1015,7 +1015,7 @@ export class InputHandler extends Disposable implements IInputHandler { * | 2 | Erase complete viewport. | * | 3 | Erase scrollback. | * - * @vt: partly CSI DECSED "Selective Erase In Display" "CSI ? Ps J" "Currently the same as ED." + * @vt: #P[Protection attributes are not supported.] CSI DECSED "Selective Erase In Display" "CSI ? Ps J" "Currently the same as ED." */ public eraseInDisplay(params: IParams): void { this._restrictCursor(); @@ -1077,7 +1077,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 1 -> Selective Erase to Left. * Ps = 2 -> Selective Erase All. * - * @vt: supported CSI EL "Erase In Line" "CSI Ps K" "Erase various parts of the active row." + * @vt: #Y CSI EL "Erase In Line" "CSI Ps K" "Erase various parts of the active row." * Supported param values: * * | Ps | Effect | @@ -1086,7 +1086,7 @@ export class InputHandler extends Disposable implements IInputHandler { * | 1 | Erase from the beginning of the line through the cursor. | * | 2 | Erase complete line. | * - * @vt: partly CSI DECSEL "Selective Erase In Line" "CSI ? Ps K" "Currently the same as EL." + * @vt: #P[Protection attributes are not supported.] CSI DECSEL "Selective Erase In Line" "CSI ? Ps K" "Currently the same as EL." */ public eraseInLine(params: IParams): void { this._restrictCursor(); @@ -1108,7 +1108,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps L * 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)." + * @vt: #Y CSI IL "Insert Line" "CSI Ps L" "Insert `Ps` blank lines at active row (default=1)." * For every inserted line at the scroll top one line at the scroll bottom gets removed. * The cursor is set to the first column. * IL has no effect if the cursor is outside the scroll margins. @@ -1143,7 +1143,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps M * Delete Ps Line(s) (default = 1) (DL). * - * @vt: supported CSI DL "Delete Line" "CSI Ps M" "Delete `Ps` lines at active row (default=1)." + * @vt: #Y CSI DL "Delete Line" "CSI Ps M" "Delete `Ps` lines at active row (default=1)." * For every deleted line at the scroll top one blank line at the scroll bottom gets appended. * The cursor is set to the first column. * DL has no effect if the cursor is outside the scroll margins. @@ -1179,7 +1179,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps @ * Insert Ps (Blank) Character(s) (default = 1) (ICH). * - * @vt: supported CSI ICH "Insert Characters" "CSI Ps @" "Insert `Ps` (blank) characters (default = 1)." + * @vt: #Y CSI ICH "Insert Characters" "CSI Ps @" "Insert `Ps` (blank) characters (default = 1)." * The ICH sequence inserts `Ps` blank characters. The cursor remains at the beginning of the blank characters. * Text between the cursor and right margin moves to the right. Characters moved past the right margin are lost. * @@ -1204,7 +1204,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps P * Delete Ps Character(s) (default = 1) (DCH). * - * @vt: supported CSI DCH "Delete Character" "CSI Ps P" "Delete `Ps` characters (default=1)." + * @vt: #Y CSI DCH "Delete Character" "CSI Ps P" "Delete `Ps` characters (default=1)." * As characters are deleted, the remaining characters between the cursor and right margin move to the left. * Character attributes move with the characters. The terminal adds blank characters at the right margin. * @@ -1228,7 +1228,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * 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)." + * @vt: #Y CSI SU "Scroll Up" "CSI Ps S" "Scroll `Ps` lines up (default=1)." * * * FIXME: scrolled out lines at top = 1 should add to scrollback (xterm) @@ -1249,7 +1249,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * 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)." + * @vt: #Y CSI SD "Scroll Down" "CSI Ps T" "Scroll `Ps` lines down (default=1)." */ public scrollDown(params: IParams): void { let param = params.params[0] || 1; @@ -1278,7 +1278,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Supported: * - always left shift (no line orientation setting respected) * - * @vt: supported CSI SL "Scroll Left" "CSI Ps SP @" "Scroll viewport `Ps` times to the left." + * @vt: #Y CSI SL "Scroll Left" "CSI Ps SP @" "Scroll viewport `Ps` times to the left." * SL moves the content of all lines within the scroll margins `Ps` times to the left. * SL has no effect outside of the scroll margins. */ @@ -1310,7 +1310,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Supported: * - 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." + * @vt: #Y CSI SR "Scroll Right" "CSI Ps SP A" "Scroll viewport `Ps` times to the right." * SL moves the content of all lines within the scroll margins `Ps` times to the right. * Content at the right margin is lost. * SL has no effect outside of the scroll margins. @@ -1333,7 +1333,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Pm ' } * Insert Ps Column(s) (default = 1) (DECIC), VT420 and up. * - * @vt: supported CSI DECIC "Insert Columns" "CSI Ps ' }" "Insert `Ps` columns at cursor position." + * @vt: #Y CSI DECIC "Insert Columns" "CSI Ps ' }" "Insert `Ps` columns at cursor position." * DECIC inserts `Ps` times blank columns at the cursor position for all lines with the scroll margins, * moving content to the right. Content at the right margin is lost. * DECIC has no effect outside the scrolling margins. @@ -1356,7 +1356,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Pm ' ~ * Delete Ps Column(s) (default = 1) (DECDC), VT420 and up. * - * @vt: supported CSI DECDC "Delete Columns" "CSI Ps ' ~" "Delete `Ps` columns at cursor position." + * @vt: #Y CSI DECDC "Delete Columns" "CSI Ps ' ~" "Delete `Ps` columns at cursor position." * DECDC deletes `Ps` times columns at the cursor position for all lines with the scroll margins, * moving content to the left. Blank columns are added at the right margin. * DECDC has no effect outside the scrolling margins. @@ -1379,7 +1379,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI Ps X * Erase Ps Character(s) (default = 1) (ECH). * - * @vt: supported CSI ECH "Erase Character" "CSI Ps X" "Erase `Ps` characters from current cursor position to the right (default=1)." + * @vt: #Y CSI ECH "Erase Character" "CSI Ps X" "Erase `Ps` characters from current cursor position to the right (default=1)." * ED erases `Ps` characters from current cursor position to the right. * ED works inside or outside the scrolling margins. */ @@ -1419,7 +1419,7 @@ export class InputHandler extends Disposable implements IInputHandler { * 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`. * - * @vt: supported CSI REP "Repeat Preceding Character" "CSI Ps b" "Repeat preceding character `Ps` times (default=1)." + * @vt: #Y CSI REP "Repeat Preceding Character" "CSI Ps b" "Repeat preceding character `Ps` times (default=1)." * REP repeats the previous character `Ps` times advancing the cursor, also wrapping if DECAWM is set. * REP has no effect if the sequence does not follow a printable ASCII character * (NOOP for any other sequence in between or NON ASCII characters). @@ -1457,7 +1457,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 2 2 -> ANSI color, e.g., VT525. * Ps = 2 9 -> ANSI text locator (i.e., DEC Locator mode). * - * @vt: supported CSI DA1 "Primary Device Attributes" "CSI c" "Send primary device attributes." + * @vt: #Y CSI DA1 "Primary Device Attributes" "CSI c" "Send primary device attributes." * * * TODO: fix and cleanup response @@ -1492,7 +1492,7 @@ 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 (?) * - * @vt: supported CSI DA2 "Secondary Device Attributes" "CSI > c" "Send primary device attributes." + * @vt: #Y CSI DA2 "Secondary Device Attributes" "CSI > c" "Send primary device attributes." * * * TODO: fix and cleanup response @@ -1524,15 +1524,15 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 1 2 -> Send/receive (SRM). * Ps = 2 0 -> Automatic Newline (LNM). * - * @vt: partly CSI SM "Set Mode" "CSI Pm h" "Set various terminal modes." + * @vt: #P[Only IRM is supported.] CSI SM "Set Mode" "CSI Pm h" "Set various terminal modes." * Supported param values by SM: * - * | Param | Action | Status | - * | ----- | -------------------------------------- | ----------- | - * | 2 | Keyboard Action Mode (KAM). Always on. | unsupported | - * | 4 | Insert Mode (IRM). | supported | - * | 12 | Send/receive (SRM). Always off. | unsupported | - * | 20 | Automatic Newline (LNM). Always off. | unsupported | + * | Param | Action | Support | + * | ----- | -------------------------------------- | ------- | + * | 2 | Keyboard Action Mode (KAM). Always on. | #N | + * | 4 | Insert Mode (IRM). | #Y | + * | 12 | Send/receive (SRM). Always off. | #N | + * | 20 | Automatic Newline (LNM). Always off. | #N | * * * FIXME: why is LNM commented out? @@ -1631,33 +1631,33 @@ export class InputHandler extends Disposable implements IInputHandler { * Modes: * http: *vt100.net/docs/vt220-rm/chapter4.html * - * @vt: partly CSI DECSET "DEC Private Set Mode" "CSI ? Pm h" "Set various terminal attributes." + * @vt: #P[See below for supported modes.] CSI DECSET "DEC Private Set Mode" "CSI ? Pm h" "Set various terminal attributes." * Supported param values by DECSET: * - * | param | Action | Status | - * | ----- | ------------------------------------------------------- | ----------- | - * | 1 | Application Cursor Keys (DECCKM). | supported | - * | 2 | Designate US-ASCII for character sets G0-G3 (DECANM). | supported | - * | 3 | 132 Column Mode (DECCOLM). | supported | - * | 6 | Origin Mode (DECOM). | supported | - * | 7 | Auto-wrap Mode (DECAWM). | supported | - * | 8 | Auto-repeat Keys (DECARM). Always on. | unsupported | - * | 9 | X10 xterm mouse protocol. | supported | - * | 12 | Start Blinking Cursor. | supported | - * | 25 | Show Cursor (DECTCEM). | supported | - * | 47 | Use Alternate Screen Buffer. | supported | - * | 66 | Application keypad (DECNKM). | supported | - * | 1000 | X11 xterm mouse protocol. | supported | - * | 1002 | Use Cell Motion Mouse Tracking. | supported | - * | 1003 | Use All Motion Mouse Tracking. | supported | - * | 1004 | Send FocusIn/FocusOut events | supported | - * | 1005 | Enable UTF-8 Mouse Mode. | unsupported | - * | 1006 | Enable SGR Mouse Mode. | supported | - * | 1015 | Enable urxvt Mouse Mode. | unsupported | - * | 1047 | Use Alternate Screen Buffer. | supported | - * | 1048 | Save cursor as in DECSC. | supported | - * | 1049 | Save cursor and switch to alternate buffer clearing it. | partly | - * | 2004 | Set bracketed paste mode. | supported | + * | param | Action | Support | + * | ----- | ------------------------------------------------------- | --------| + * | 1 | Application Cursor Keys (DECCKM). | #Y | + * | 2 | Designate US-ASCII for character sets G0-G3 (DECANM). | #Y | + * | 3 | 132 Column Mode (DECCOLM). | #Y | + * | 6 | Origin Mode (DECOM). | #Y | + * | 7 | Auto-wrap Mode (DECAWM). | #Y | + * | 8 | Auto-repeat Keys (DECARM). Always on. | #N | + * | 9 | X10 xterm mouse protocol. | #Y | + * | 12 | Start Blinking Cursor. | #Y | + * | 25 | Show Cursor (DECTCEM). | #Y | + * | 47 | Use Alternate Screen Buffer. | #Y | + * | 66 | Application keypad (DECNKM). | #Y | + * | 1000 | X11 xterm mouse protocol. | #Y | + * | 1002 | Use Cell Motion Mouse Tracking. | #Y | + * | 1003 | Use All Motion Mouse Tracking. | #Y | + * | 1004 | Send FocusIn/FocusOut events | #Y | + * | 1005 | Enable UTF-8 Mouse Mode. | #N | + * | 1006 | Enable SGR Mouse Mode. | #Y | + * | 1015 | Enable urxvt Mouse Mode. | #N | + * | 1047 | Use Alternate Screen Buffer. | #Y | + * | 1048 | Save cursor as in DECSC. | #Y | + * | 1049 | Save cursor and switch to alternate buffer clearing it. | #P[Does not clear the alternate buffer.] | + * | 2004 | Set bracketed paste mode. | #Y | * * * FIXME: implement DECSCNM, 1049 should clear altbuffer @@ -1757,15 +1757,15 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 1 2 -> Send/receive (SRM). * Ps = 2 0 -> Normal Linefeed (LNM). * - * @vt: partly CSI RM "Reset Mode" "CSI Pm l" "Set various terminal attributes." + * @vt: #P[Only IRM is supported.] CSI RM "Reset Mode" "CSI Pm l" "Set various terminal attributes." * Supported param values by RM: * - * | Param | Action | Status | - * | ----- | -------------------------------------- | ----------- | - * | 2 | Keyboard Action Mode (KAM). Always on. | unsupported | - * | 4 | Replace Mode (IRM). (default) | supported | - * | 12 | Send/receive (SRM). Always off. | unsupported | - * | 20 | Normal Linefeed (LNM). Always off. | unsupported | + * | Param | Action | Support | + * | ----- | -------------------------------------- | ------- | + * | 2 | Keyboard Action Mode (KAM). Always on. | #N | + * | 4 | Replace Mode (IRM). (default) | #Y | + * | 12 | Send/receive (SRM). Always off. | #N | + * | 20 | Normal Linefeed (LNM). Always off. | #N | * * * FIXME: why is LNM commented out? @@ -1860,33 +1860,33 @@ 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. * - * @vt: partly CSI DECRST "DEC Private Reset Mode" "CSI ? Pm l" "Reset various terminal attributes." + * @vt: #P[See below for supported modes.] CSI DECRST "DEC Private Reset Mode" "CSI ? Pm l" "Reset various terminal attributes." * Supported param values by DECRST: * - * | param | Action | Status | - * | ----- | ------------------------------------------------------- | ----------- | - * | 1 | Normal Cursor Keys (DECCKM). | supported | - * | 2 | Designate VT52 mode (DECANM). | unsupported | - * | 3 | 80 Column Mode (DECCOLM). | broken | - * | 6 | Normal Cursor Mode (DECOM). | supported | - * | 7 | No Wraparound Mode (DECAWM). | supported | - * | 8 | No Auto-repeat Keys (DECARM). | unsupported | - * | 9 | Don't send Mouse X & Y on button press. | supported | - * | 12 | Stop Blinking Cursor. | supported | - * | 25 | Hide Cursor (DECTCEM). | supported | - * | 47 | Use Normal Screen Buffer. | supported | - * | 66 | Numeric keypad (DECNKM). | supported | - * | 1000 | Don't send Mouse reports. | supported | - * | 1002 | Don't use Cell Motion Mouse Tracking. | supported | - * | 1003 | Don't use All Motion Mouse Tracking. | supported | - * | 1004 | Don't send FocusIn/FocusOut events. | supported | - * | 1005 | Disable UTF-8 Mouse Mode. | unsupported | - * | 1006 | Disable SGR Mouse Mode. | supported | - * | 1015 | Disable urxvt Mouse Mode. | unsupported | - * | 1047 | Use Normal Screen Buffer (clearing screen if in alt). | supported | - * | 1048 | Restore cursor as in DECRC. | supported | - * | 1049 | Use Normal Screen Buffer and restore cursor. | supported | - * | 2004 | Reset bracketed paste mode. | supported | + * | param | Action | Support | + * | ----- | ------------------------------------------------------- | ------- | + * | 1 | Normal Cursor Keys (DECCKM). | #Y | + * | 2 | Designate VT52 mode (DECANM). | #N | + * | 3 | 80 Column Mode (DECCOLM). | #B[Switches to old column width instead of 80.] | + * | 6 | Normal Cursor Mode (DECOM). | #Y | + * | 7 | No Wraparound Mode (DECAWM). | #Y | + * | 8 | No Auto-repeat Keys (DECARM). | #N | + * | 9 | Don't send Mouse X & Y on button press. | #Y | + * | 12 | Stop Blinking Cursor. | #Y | + * | 25 | Hide Cursor (DECTCEM). | #Y | + * | 47 | Use Normal Screen Buffer. | #Y | + * | 66 | Numeric keypad (DECNKM). | #Y | + * | 1000 | Don't send Mouse reports. | #Y | + * | 1002 | Don't use Cell Motion Mouse Tracking. | #Y | + * | 1003 | Don't use All Motion Mouse Tracking. | #Y | + * | 1004 | Don't send FocusIn/FocusOut events. | #Y | + * | 1005 | Disable UTF-8 Mouse Mode. | #N | + * | 1006 | Disable SGR Mouse Mode. | #Y | + * | 1015 | Disable urxvt Mouse Mode. | #N | + * | 1047 | Use Normal Screen Buffer (clearing screen if in alt). | #Y | + * | 1048 | Restore cursor as in DECRC. | #Y | + * | 1049 | Use Normal Screen Buffer and restore cursor. | #Y | + * | 2004 | Reset bracketed paste mode. | #Y | * * * FIXME: DECCOLM is currently broken (already fixed in window options PR) @@ -2041,7 +2041,7 @@ export class InputHandler extends Disposable implements IInputHandler { /** * CSI Pm m Character Attributes (SGR). * - * @vt: partly CSI SGR "Select Graphic Rendition" "CSI Pm m" "Set/Reset various text attributes." + * @vt: #P[See below for supported attributes.] CSI SGR "Select Graphic Rendition" "CSI Pm m" "Set/Reset various text attributes." * SGR selects one or more character attributes at the same time. Multiple params (up to 32) * are applied from in order from left to right. The changed attributes are applied to all new * characters received. If you move characters in the viewport by scrolling or any other means, @@ -2049,59 +2049,59 @@ export class InputHandler extends Disposable implements IInputHandler { * * Supported param values by SGR: * - * | Param | Meaning | Status | - * | --------- | -------------------------------------------------------- | ----------- | - * | 0 | Normal (default). Resets any other preceding SGR. | supported | - * | 1 | Bold. (also see `options.drawBoldTextInBrightColors`) | supported | - * | 2 | Faint, decreased intensity. | supported | - * | 3 | Italic. | supported | - * | 4 | Underlined. (no support for newer underline styles) | supported | - * | 5 | Slowly blinking. | unsupported | - * | 6 | Rapidly blinking. | unsupported | - * | 7 | Inverse. Flips foreground and background color. | supported | - * | 8 | Invisible (hidden). | supported | - * | 9 | Crossed-out characters. | unsupported | - * | 21 | Doubly underlined. | unsupported | - * | 22 | Normal (neither bold nor faint). | supported | - * | 23 | No italic. | supported | - * | 24 | Not underlined. | supported | - * | 25 | Steady (not blinking). | supported | - * | 27 | Positive (not inverse). | supported | - * | 28 | Visible (not hidden). | supported | - * | 29 | Not Crossed-out. | unsupported | - * | 30 | Foreground color: Black. | supported | - * | 31 | Foreground color: Red. | supported | - * | 32 | Foreground color: Green. | supported | - * | 33 | Foreground color: Yellow. | supported | - * | 34 | Foreground color: Blue. | supported | - * | 35 | Foreground color: Magenta. | supported | - * | 36 | Foreground color: Cyan. | supported | - * | 37 | Foreground color: White. | supported | - * | 38 | Foreground color: Extended color (see below). | supported | - * | 39 | Foreground color: Default (original). | supported | - * | 40 | Background color: Black. | supported | - * | 41 | Background color: Red. | supported | - * | 42 | Background color: Green. | supported | - * | 43 | Background color: Yellow. | supported | - * | 44 | Background color: Blue. | supported | - * | 45 | Background color: Magenta. | supported | - * | 46 | Background color: Cyan. | supported | - * | 47 | Background color: White. | supported | - * | 48 | Background color: Extended color (see below). | supported | - * | 49 | Background color: Default (original). | supported | - * | 90 - 97 | Bright foreground color (analogous to 30 -37). | supported | - * | 100 - 107 | Bright background color (analogous to 40 -47). | supported | + * | Param | Meaning | Support | + * | --------- | -------------------------------------------------------- | ------- | + * | 0 | Normal (default). Resets any other preceding SGR. | #Y | + * | 1 | Bold. (also see `options.drawBoldTextInBrightColors`) | #Y | + * | 2 | Faint, decreased intensity. | #Y | + * | 3 | Italic. | #Y | + * | 4 | Underlined. (no support for newer underline styles) | #Y | + * | 5 | Slowly blinking. | #N | + * | 6 | Rapidly blinking. | #N | + * | 7 | Inverse. Flips foreground and background color. | #Y | + * | 8 | Invisible (hidden). | #Y | + * | 9 | Crossed-out characters. | #N | + * | 21 | Doubly underlined. | #N | + * | 22 | Normal (neither bold nor faint). | #Y | + * | 23 | No italic. | #Y | + * | 24 | Not underlined. | #Y | + * | 25 | Steady (not blinking). | #Y | + * | 27 | Positive (not inverse). | #Y | + * | 28 | Visible (not hidden). | #Y | + * | 29 | Not Crossed-out. | #N | + * | 30 | Foreground color: Black. | #Y | + * | 31 | Foreground color: Red. | #Y | + * | 32 | Foreground color: Green. | #Y | + * | 33 | Foreground color: Yellow. | #Y | + * | 34 | Foreground color: Blue. | #Y | + * | 35 | Foreground color: Magenta. | #Y | + * | 36 | Foreground color: Cyan. | #Y | + * | 37 | Foreground color: White. | #Y | + * | 38 | Foreground color: Extended color. | #P[Support for RGB and indexed colors, see below.] | + * | 39 | Foreground color: Default (original). | #Y | + * | 40 | Background color: Black. | #Y | + * | 41 | Background color: Red. | #Y | + * | 42 | Background color: Green. | #Y | + * | 43 | Background color: Yellow. | #Y | + * | 44 | Background color: Blue. | #Y | + * | 45 | Background color: Magenta. | #Y | + * | 46 | Background color: Cyan. | #Y | + * | 47 | Background color: White. | #Y | + * | 48 | Background color: Extended color. | #P[Support for RGB and indexed colors, see below.] | + * | 49 | Background color: Default (original). | #Y | + * | 90 - 97 | Bright foreground color (analogous to 30 - 37). | #Y | + * | 100 - 107 | Bright background color (analogous to 40 - 47). | #Y | * * Extended colors are supported for foreground (Ps=38) and background (Ps=48) as follows: * - * | Ps + 1 | Meaning | Status | - * | ------ | ------------------------------------------------------------- | ----------- | - * | 0 | Implementation defined. | unsupported | - * | 1 | Transparent. | unsupported | - * | 2 | RGB color as `Ps ; 2 ; R ; G ; B` or `Ps : 2 : : R : G : B`. | supported | - * | 3 | CMY color. | unsupported | - * | 4 | CMYK color. | unsupported | - * | 5 | Indexed (256 colors) as `Ps ; 5 ; INDEX` or `Ps : 5 : INDEX`. | supported | + * | Ps + 1 | Meaning | Support | + * | ------ | ------------------------------------------------------------- | ------- | + * | 0 | Implementation defined. | #N | + * | 1 | Transparent. | #N | + * | 2 | RGB color as `Ps ; 2 ; R ; G ; B` or `Ps : 2 : : R : G : B`. | #Y | + * | 3 | CMY color. | #N | + * | 4 | CMYK color. | #N | + * | 5 | Indexed (256 colors) as `Ps ; 5 ; INDEX` or `Ps : 5 : INDEX`. | #Y | * * * FIXME: blinking is implemented in attrs, but not working in renderers? @@ -2228,7 +2228,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. * - * @vt: supported CSI DSR "Device Status Report" "CSI Ps n" "Request cursor position (CPR) with `Ps` = 6." + * @vt: #Y CSI DSR "Device Status Report" "CSI Ps n" "Request cursor position (CPR) with `Ps` = 6." */ public deviceStatus(params: IParams): void { switch (params.params[0]) { @@ -2245,7 +2245,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)." + // @vt: #P[Only CPR is supported.] CSI DECDSR "DEC Device Status Report" "CSI ? Ps n" "Only CPR is supported (same as DSR)." public deviceStatusPrivate(params: IParams): void { // modern xterm doesnt seem to // respond to any of these except ?6, 6, and 5 @@ -2279,7 +2279,7 @@ export class InputHandler extends Disposable implements IInputHandler { * CSI ! p Soft terminal reset (DECSTR). * 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." + * @vt: #Y 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. * @@ -2315,7 +2315,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Ps = 5 -> blinking bar (xterm). * Ps = 6 -> steady bar (xterm). * - * @vt: supported CSI DECSCUSR "Set Cursor Style" "CSI Ps SP q" "Set cursor style." + * @vt: #Y CSI DECSCUSR "Set Cursor Style" "CSI Ps SP q" "Set cursor style." * Supported cursor styles: * - empty, 0 or 1: steady block * - 2: blink block @@ -2349,7 +2349,7 @@ export class InputHandler extends Disposable implements IInputHandler { * Set Scrolling Region [top;bottom] (default = full size of win- * 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)." + * @vt: #Y CSI DECSTBM "Set Top and Bottom Margin" "CSI Ps ; Ps r" "Set top and bottom margins of the viewport [top;bottom] (default = viewport size)." */ public setScrollRegion(params: IParams): void { const top = params.params[0] || 1; @@ -2372,8 +2372,8 @@ export class InputHandler extends Disposable implements IInputHandler { * ESC 7 * 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." + * @vt: #P[TODO...] CSI SCOSC "Save Cursor" "CSI s" "Save cursor position, charmap and text attributes." + * @vt: #Y ESC SC "Save Cursor" "ESC 7" "Save cursor position, charmap and text attributes." */ public saveCursor(params?: IParams): void { this._bufferService.buffer.savedX = this._bufferService.buffer.x; @@ -2389,8 +2389,8 @@ export class InputHandler extends Disposable implements IInputHandler { * ESC 8 * 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." + * @vt: #P[TODO...] CSI SCORC "Restore Cursor" "CSI u" "Restore cursor position, charmap and text attributes." + * @vt: #Y ESC RC "Restore Cursor" "ESC 8" "Restore cursor position, charmap and text attributes." */ public restoreCursor(params?: IParams): void { this._bufferService.buffer.x = this._bufferService.buffer.savedX || 0; @@ -2410,10 +2410,10 @@ export class InputHandler extends Disposable implements IInputHandler { * OSC 2; ST (set window title) * 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." + * @vt: #P[Icon name is not exposed.] 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." + * @vt: #Y 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 { @@ -2426,8 +2426,8 @@ 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. * - * @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." + * @vt: #Y C1 NEL "Next Line" "\x85" "Move the cursor to the beginning of the next row." + * @vt: #Y ESC NEL "Next Line" "ESC E" "Move the cursor to the beginning of the next row." */ public nextLine(): void { this._bufferService.buffer.x = 0; @@ -2501,8 +2501,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. * - * @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." + * @vt: #Y C1 IND "Index" "\x84" "Move the cursor one line down scrolling if needed." + * @vt: #Y ESC IND "Index" "ESC D" "Move the cursor one line down scrolling if needed." */ public index(): void { this._restrictCursor(); @@ -2524,8 +2524,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. * - * @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." + * @vt: #Y C1 HTS "Horizontal Tabulation Set" "\x88" "Places a tab stop at the current cursor position." + * @vt: #Y ESC HTS "Horizontal Tabulation Set" "ESC H" "Places a tab stop at the current cursor position." */ public tabSet(): void { this._bufferService.buffer.tabs[this._bufferService.buffer.x] = true; @@ -2538,7 +2538,7 @@ 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. * - * @vt: supported ESC IR "Reverse Index" "ESC M" "Move the cursor one line up scrolling if needed." + * @vt: #Y ESC IR "Reverse Index" "ESC M" "Move the cursor one line up scrolling if needed." */ public reverseIndex(): void { this._restrictCursor(); @@ -2601,7 +2601,7 @@ export class InputHandler extends Disposable implements IInputHandler { * This control function fills the complete screen area with * a test pattern (E) used for adjusting screen alignment. * - * @vt: supported ESC DECALN "Screen Alignment Pattern" "ESC # 8" "Fill viewport with a test pattern (E)." + * @vt: #Y ESC DECALN "Screen Alignment Pattern" "ESC # 8" "Fill viewport with a test pattern (E)." */ public screenAlignmentPattern(): void { // prepare cell data From d2145368fa890261cf166a47a66f7aeb28c66c27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Fri, 10 Jan 2020 18:51:27 +0100 Subject: [PATCH 19/21] several template updates --- bin/extract_vtfeatures.js | 110 +++++++++++++++++++++++++++++++++++--- 1 file changed, 102 insertions(+), 8 deletions(-) diff --git a/bin/extract_vtfeatures.js b/bin/extract_vtfeatures.js index 51630a62..7b77639d 100644 --- a/bin/extract_vtfeatures.js +++ b/bin/extract_vtfeatures.js @@ -33,10 +33,14 @@ const TYPES = [ ]; const MARKDOWN_TMPL = ` +{::options parse_block_html="true" /} + xterm.js version: {{version}} ## Table of Contents + + + ## General notes This document lists xterm.js' support of terminal sequences. The sequences are grouped by their sequence type: @@ -82,22 +89,27 @@ To denote the sequences the tables use the same abbreviations as xterm does: ASCII printables are specified to work. Additionally the parser will let pass any codepoint greater than C1 as printable. + {{#C0.length}} ## C0 | Mnemonic | Name | Sequence | Short Description | Support | | -------- | ---- | -------- | ----------------- | ------- | {{#C0}} -| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{{status}}} | +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}}){: .link-details}_{{/longDescription.length}} | {{{status}}} | {{/C0}} {{#C0.hasLongDescriptions}} {{#C0}} {{#longDescription.length}} +
+ ### {{name}} {{#longDescription}} {{{.}}} {{/longDescription}} + +
{{/longDescription.length}} {{/C0}} {{/C0.hasLongDescriptions}} @@ -111,16 +123,20 @@ To denote the sequences the tables use the same abbreviations as xterm does: | Mnemonic | Name | Sequence | Short Description | Support | | -------- | ---- | -------- | ----------------- | ------- | {{#C1}} -| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{{status}}} | +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}}){: .link-details}_{{/longDescription.length}} | {{{status}}} | {{/C1}} {{#C1.hasLongDescriptions}} {{#C1}} {{#longDescription.length}} +
+ ### {{name}} {{#longDescription}} {{{.}}} {{/longDescription}} + +
{{/longDescription.length}} {{/C1}} {{/C1.hasLongDescriptions}} @@ -134,16 +150,20 @@ To denote the sequences the tables use the same abbreviations as xterm does: | Mnemonic | Name | Sequence | Short Description | Support | | -------- | ---- | -------- | ----------------- | ------- | {{#CSI}} -| {{mnemonic}} | {{name}} | \`\`{{{sequence}}}\`\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{{status}}} | +| {{mnemonic}} | {{name}} | \`\`{{{sequence}}}\`\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}}){: .link-details}_{{/longDescription.length}} | {{{status}}} | {{/CSI}} {{#CSI.hasLongDescriptions}} {{#CSI}} {{#longDescription.length}} +
+ ### {{name}} {{#longDescription}} {{{.}}} {{/longDescription}} + +
{{/longDescription.length}} {{/CSI}} {{/CSI.hasLongDescriptions}} @@ -157,16 +177,20 @@ To denote the sequences the tables use the same abbreviations as xterm does: | Mnemonic | Name | Sequence | Short Description | Support | | -------- | ---- | -------- | ----------------- | ------- | {{#DCS}} -| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{{status}}} | +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}}){: .link-details}_{{/longDescription.length}} | {{{status}}} | {{/DCS}} {{#DCS.hasLongDescriptions}} {{#DCS}} {{#longDescription.length}} +
+ ### {{name}} {{#longDescription}} {{{.}}} {{/longDescription}} + +
{{/longDescription.length}} {{/DCS}} {{/DCS.hasLongDescriptions}} @@ -180,16 +204,20 @@ To denote the sequences the tables use the same abbreviations as xterm does: | Mnemonic | Name | Sequence | Short Description | Support | | -------- | ---- | -------- | ----------------- | ------- | {{#ESC}} -| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{{status}}} | +| {{mnemonic}} | {{name}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}}){: .link-details}_{{/longDescription.length}} | {{{status}}} | {{/ESC}} {{#ESC.hasLongDescriptions}} {{#ESC}} {{#longDescription.length}} +
+ ### {{name}} {{#longDescription}} {{{.}}} {{/longDescription}} + +
{{/longDescription.length}} {{/ESC}} {{/ESC.hasLongDescriptions}} @@ -205,21 +233,87 @@ To denote the sequences the tables use the same abbreviations as xterm does: | Identifier | Sequence | Short Description | Support | | ---------- | -------- | ----------------- | ------- | {{#OSC}} -| {{mnemonic}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}})_{{/longDescription.length}} | {{{status}}} | +| {{mnemonic}} | \`{{sequence}}\` | {{{shortDescription}}} {{#longDescription.length}}_[more](#{{longTarget}}){: .link-details}_{{/longDescription.length}} | {{{status}}} | {{/OSC}} {{#OSC.hasLongDescriptions}} {{#OSC}} {{#longDescription.length}} +
+ ### {{name}} {{#longDescription}} {{{.}}} {{/longDescription}} + +
{{/longDescription.length}} {{/OSC}} {{/OSC.hasLongDescriptions}} {{/OSC.length}} + + ` // support status marcos @@ -232,9 +326,9 @@ const MACRO = [ // #N - unsupported [/#N/g, s => ''], // #P[reason] - partial support with a reason as title - [/#P\[(.*?)\]/g, (s, p1) => `Partial`], + [/#P\[(.*?)\]/g, (s, p1) => `Partial`], // #B[reason] - supported but broken in a certain way, reason in title - [/#B\[(.*?)\]/g, (s, p1) => `Broken`] + [/#B\[(.*?)\]/g, (s, p1) => `Broken`] ]; function applyMacros(s) { From a980b3d1323661f8d678bfa5c458ec4773712eed Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 4 Feb 2020 06:43:17 -0800 Subject: [PATCH 20/21] Handle links safely by removing opener from window Fixes #2608 --- addons/xterm-addon-web-links/src/WebLinksAddon.ts | 8 +++++++- src/browser/Linkifier.ts | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/addons/xterm-addon-web-links/src/WebLinksAddon.ts b/addons/xterm-addon-web-links/src/WebLinksAddon.ts index 26d5904b..3290a59c 100644 --- a/addons/xterm-addon-web-links/src/WebLinksAddon.ts +++ b/addons/xterm-addon-web-links/src/WebLinksAddon.ts @@ -26,7 +26,13 @@ const end = ')($|' + negatedPathCharacterSet + ')'; const strictUrlRegex = new RegExp(start + protocolClause + bodyClause + end); function handleLink(event: MouseEvent, uri: string): void { - window.open(uri, '_blank'); + const newWindow = window.open(); + if (newWindow) { + newWindow.opener = null; + newWindow.location.href = uri; + } else { + console.warn('Opening link blocked as opener could not be cleared'); + } } export class WebLinksAddon implements ITerminalAddon { diff --git a/src/browser/Linkifier.ts b/src/browser/Linkifier.ts index 30c76e8a..971501b7 100644 --- a/src/browser/Linkifier.ts +++ b/src/browser/Linkifier.ts @@ -298,7 +298,13 @@ export class Linkifier implements ILinkifier { if (matcher.handler) { return matcher.handler(e, uri); } - window.open(uri, '_blank'); + const newWindow = window.open(); + if (newWindow) { + newWindow.opener = null; + newWindow.location.href = uri; + } else { + console.warn('Opening link blocked as opener could not be cleared'); + } }, () => { this._onLinkHover.fire(this._createLinkHoverEvent(x1, y1, x2, y2, fg)); From b7ae55a07b3347e703c2ec8862c76126e4a376a7 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 4 Feb 2020 06:46:25 -0800 Subject: [PATCH 21/21] Make parser stable, remove deprecated APIs Fixes #2607 --- typings/xterm.d.ts | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index 99c1440d..b8caa065 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -1008,7 +1008,7 @@ declare module 'xterm' { } /** - * (EXPERIMENTAL) Data type to register a CSI, DCS or ESC callback in the parser + * Data type to register a CSI, DCS or ESC callback in the parser * in the form: * ESC I..I F * CSI Prefix P..P I..I F @@ -1052,7 +1052,7 @@ declare module 'xterm' { } /** - * (EXPERIMENTAL) Parser interface. + * Allows hooking into the parser for custom handling of escape sequences. */ export interface IParser { /** @@ -1069,11 +1069,6 @@ declare module 'xterm' { */ registerCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean): IDisposable; - /** - * @deprecated use `registerMarker` instead. - */ - addCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean): IDisposable; - /** * Adds a handler for DCS escape sequences. * @param id Specifies the function identifier under which the callback @@ -1093,11 +1088,6 @@ declare module 'xterm' { */ registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean): IDisposable; - /** - * @deprecated use `registerMarker` instead. - */ - addDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean): IDisposable; - /** * Adds a handler for ESC escape sequences. * @param id Specifies the function identifier under which the callback @@ -1111,11 +1101,6 @@ declare module 'xterm' { */ registerEscHandler(id: IFunctionIdentifier, handler: () => boolean): IDisposable; - /** - * @deprecated use `registerMarker` instead. - */ - addEscHandler(id: IFunctionIdentifier, handler: () => boolean): IDisposable; - /** * Adds a handler for OSC escape sequences. * @param ident The number (first parameter) of the sequence. @@ -1133,11 +1118,6 @@ declare module 'xterm' { * @return An IDisposable you can call to remove this handler. */ registerOscHandler(ident: number, callback: (data: string) => boolean): IDisposable; - - /** - * @deprecated use `registerMarker` instead. - */ - addOscHandler(ident: number, callback: (data: string) => boolean): IDisposable; } /**