Skip to content

Commit

Permalink
Merge pull request #4098 from jerch/protected
Browse files Browse the repository at this point in the history
protection flag support
  • Loading branch information
Tyriar committed Sep 12, 2022
2 parents 3387d7f + 74b5d3f commit d3fd3d0
Show file tree
Hide file tree
Showing 7 changed files with 190 additions and 156 deletions.
13 changes: 8 additions & 5 deletions bin/extract_vtfeatures.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,15 @@ This document lists xterm.js' support of terminal sequences. The sequences are g
- 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.
any sequence of these types will be silently ignored. They are also not hookable by the API.
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.
Note that the list only marks sequences implemented in xterm.js' core codebase as supported. Missing sequences are either
not supported or unstable/experimental. Furthermore addons or integrations can provide additional custom sequences
(denoted as "External" where known).
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),
- \`Pm\`: Multiple numeric parameters 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 the parser will let pass any codepoint greater than C1 as printable.
Expand Down Expand Up @@ -334,7 +335,9 @@ const MACRO = [
// #P[reason] - partial support with a reason as title
[/#P\[(.*?)\]/g, (s, p1) => `<span title="${p1}" style="text-decoration: underline">Partial</span>`],
// #B[reason] - supported but broken in a certain way, reason in title
[/#B\[(.*?)\]/g, (s, p1) => `<span title="${p1}" style="text-decoration: underline">Broken</span>`]
[/#B\[(.*?)\]/g, (s, p1) => `<span title="${p1}" style="text-decoration: underline">Broken</span>`],
// #E[notes] - support via external resource, eg. addon
[/#E\[(.*?)\]/g, (s, p1) => `<span title="${p1}" style="text-decoration: underline">External</span>`]
];

function applyMacros(s) {
Expand Down
43 changes: 43 additions & 0 deletions src/common/InputHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2146,6 +2146,49 @@ describe('InputHandler', () => {
});
});
});

describe('DECSCA and DECSED/DECSEL', () => {
it('default is unprotected', async () => {
await inputHandler.parseP('some text');
await inputHandler.parseP('\x1b[?2K');
assert.deepEqual(getLines(bufferService, 2), ['', '']);
await inputHandler.parseP('some text');
await inputHandler.parseP('\x1b[?2J');
assert.deepEqual(getLines(bufferService, 2), ['', '']);
});
it('DECSCA 1 with DECSEL', async () => {
await inputHandler.parseP('###\x1b[1"qlineerase\x1b[0"q***');
await inputHandler.parseP('\x1b[?2K');
assert.deepEqual(getLines(bufferService, 2), [' lineerase', '']);
// normal EL works as before
await inputHandler.parseP('\x1b[2K');
assert.deepEqual(getLines(bufferService, 2), ['', '']);
});
it('DECSCA 1 with DECSED', async () => {
await inputHandler.parseP('###\x1b[1"qdisplayerase\x1b[0"q***');
await inputHandler.parseP('\x1b[?2J');
assert.deepEqual(getLines(bufferService, 2), [' displayerase', '']);
// normal ED works as before
await inputHandler.parseP('\x1b[2J');
assert.deepEqual(getLines(bufferService, 2), ['', '']);
});
it('DECRQSS reports correct DECSCA state', async () => {
const sendStack: string[] = [];
coreService.onData(d => sendStack.push(d));
// DCS $ q " q ST
await inputHandler.parseP('\x1bP$q"q\x1b\\');
// default - DECSCA unset (0 or 2)
assert.deepEqual(sendStack.pop(), '\x1bP1$r0"q\x1b\\');
// DECSCA 1 - protected set
await inputHandler.parseP('###\x1b[1"q');
await inputHandler.parseP('\x1bP$q"q\x1b\\');
assert.deepEqual(sendStack.pop(), '\x1bP1$r1"q\x1b\\');
// DECSCA 2 - protected reset (same as 0)
await inputHandler.parseP('###\x1b[2"q');
await inputHandler.parseP('\x1bP$q"q\x1b\\');
assert.deepEqual(sendStack.pop(), '\x1bP1$r0"q\x1b\\'); // reported as DECSCA 0
});
});
describe('DECRQM', () => {
const reportStack: string[] = [];
beforeEach(() => {
Expand Down
Loading

0 comments on commit d3fd3d0

Please sign in to comment.