Skip to content

Commit d3fd3d0

Browse files
authored
Merge pull request #4098 from jerch/protected
protection flag support
2 parents 3387d7f + 74b5d3f commit d3fd3d0

File tree

7 files changed

+190
-156
lines changed

7 files changed

+190
-156
lines changed

bin/extract_vtfeatures.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,15 @@ This document lists xterm.js' support of terminal sequences. The sequences are g
8282
- OSC - Operating System Command: sequence starting with \`ESC ]\` (7bit) or OSC (\`\\x9D\`, 8bit)
8383
8484
Application Program Command (APC), Privacy Message (PM) and Start of String (SOS) are recognized but not supported,
85-
any sequence of these types will be ignored. They are also not hookable by the API.
85+
any sequence of these types will be silently ignored. They are also not hookable by the API.
8686
87-
Note that the list only contains sequences implemented in xterm.js' core codebase. Missing sequences are either
88-
not supported or unstable/experimental. Furthermore addons or integrations can provide additional custom sequences.
87+
Note that the list only marks sequences implemented in xterm.js' core codebase as supported. Missing sequences are either
88+
not supported or unstable/experimental. Furthermore addons or integrations can provide additional custom sequences
89+
(denoted as "External" where known).
8990
9091
To denote the sequences the tables use the same abbreviations as xterm does:
9192
- \`Ps\`: A single (usually optional) numeric parameter, composed of one or more decimal digits.
92-
- \`Pm\`: A multiple numeric parameter composed of any number of single numeric parameters, separated by ; character(s),
93+
- \`Pm\`: Multiple numeric parameters composed of any number of single numeric parameters, separated by ; character(s),
9394
e.g. \` Ps ; Ps ; ... \`.
9495
- \`Pt\`: A text parameter composed of printable characters. Note that for most commands with \`Pt\` only
9596
ASCII printables are specified to work. Additionally the parser will let pass any codepoint greater than C1 as printable.
@@ -334,7 +335,9 @@ const MACRO = [
334335
// #P[reason] - partial support with a reason as title
335336
[/#P\[(.*?)\]/g, (s, p1) => `<span title="${p1}" style="text-decoration: underline">Partial</span>`],
336337
// #B[reason] - supported but broken in a certain way, reason in title
337-
[/#B\[(.*?)\]/g, (s, p1) => `<span title="${p1}" style="text-decoration: underline">Broken</span>`]
338+
[/#B\[(.*?)\]/g, (s, p1) => `<span title="${p1}" style="text-decoration: underline">Broken</span>`],
339+
// #E[notes] - support via external resource, eg. addon
340+
[/#E\[(.*?)\]/g, (s, p1) => `<span title="${p1}" style="text-decoration: underline">External</span>`]
338341
];
339342

340343
function applyMacros(s) {

src/common/InputHandler.test.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,6 +2146,49 @@ describe('InputHandler', () => {
21462146
});
21472147
});
21482148
});
2149+
2150+
describe('DECSCA and DECSED/DECSEL', () => {
2151+
it('default is unprotected', async () => {
2152+
await inputHandler.parseP('some text');
2153+
await inputHandler.parseP('\x1b[?2K');
2154+
assert.deepEqual(getLines(bufferService, 2), ['', '']);
2155+
await inputHandler.parseP('some text');
2156+
await inputHandler.parseP('\x1b[?2J');
2157+
assert.deepEqual(getLines(bufferService, 2), ['', '']);
2158+
});
2159+
it('DECSCA 1 with DECSEL', async () => {
2160+
await inputHandler.parseP('###\x1b[1"qlineerase\x1b[0"q***');
2161+
await inputHandler.parseP('\x1b[?2K');
2162+
assert.deepEqual(getLines(bufferService, 2), [' lineerase', '']);
2163+
// normal EL works as before
2164+
await inputHandler.parseP('\x1b[2K');
2165+
assert.deepEqual(getLines(bufferService, 2), ['', '']);
2166+
});
2167+
it('DECSCA 1 with DECSED', async () => {
2168+
await inputHandler.parseP('###\x1b[1"qdisplayerase\x1b[0"q***');
2169+
await inputHandler.parseP('\x1b[?2J');
2170+
assert.deepEqual(getLines(bufferService, 2), [' displayerase', '']);
2171+
// normal ED works as before
2172+
await inputHandler.parseP('\x1b[2J');
2173+
assert.deepEqual(getLines(bufferService, 2), ['', '']);
2174+
});
2175+
it('DECRQSS reports correct DECSCA state', async () => {
2176+
const sendStack: string[] = [];
2177+
coreService.onData(d => sendStack.push(d));
2178+
// DCS $ q " q ST
2179+
await inputHandler.parseP('\x1bP$q"q\x1b\\');
2180+
// default - DECSCA unset (0 or 2)
2181+
assert.deepEqual(sendStack.pop(), '\x1bP1$r0"q\x1b\\');
2182+
// DECSCA 1 - protected set
2183+
await inputHandler.parseP('###\x1b[1"q');
2184+
await inputHandler.parseP('\x1bP$q"q\x1b\\');
2185+
assert.deepEqual(sendStack.pop(), '\x1bP1$r1"q\x1b\\');
2186+
// DECSCA 2 - protected reset (same as 0)
2187+
await inputHandler.parseP('###\x1b[2"q');
2188+
await inputHandler.parseP('\x1bP$q"q\x1b\\');
2189+
assert.deepEqual(sendStack.pop(), '\x1bP1$r0"q\x1b\\'); // reported as DECSCA 0
2190+
});
2191+
});
21492192
describe('DECRQM', () => {
21502193
const reportStack: string[] = [];
21512194
beforeEach(() => {

0 commit comments

Comments
 (0)