From b662824b81fe50564c78559843a3e39261abece1 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sun, 21 May 2023 08:16:38 -0700 Subject: [PATCH 1/3] Add isOverline to public API Part of #4529 --- typings/xterm-headless.d.ts | 2 ++ typings/xterm.d.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/typings/xterm-headless.d.ts b/typings/xterm-headless.d.ts index 2ceb6a94a4..741bce8531 100644 --- a/typings/xterm-headless.d.ts +++ b/typings/xterm-headless.d.ts @@ -999,6 +999,8 @@ declare module 'xterm-headless' { isInvisible(): number; /** Whether the cell has the strikethrough attribute (CSI 9 m). */ isStrikethrough(): number; + /** Whether the cell has the overline attribute (CSI 53 m). */ + isOverline(): number; /** Whether the cell is using the RGB foreground color mode. */ isFgRGB(): boolean; diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index 68b37153ea..6a9be2f136 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -1516,6 +1516,8 @@ declare module 'xterm' { isInvisible(): number; /** Whether the cell has the strikethrough attribute (CSI 9 m). */ isStrikethrough(): number; + /** Whether the cell has the overline attribute (CSI 53 m). */ + isOverline(): number; /** Whether the cell is using the RGB foreground color mode. */ isFgRGB(): boolean; From 325d133a75b17a1079f6cd2aa741e3e77cb542c4 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sun, 21 May 2023 08:16:57 -0700 Subject: [PATCH 2/3] Add overline to vt comments Part of #4529 --- src/common/InputHandler.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/common/InputHandler.ts b/src/common/InputHandler.ts index 65942e4d42..faa5bfde86 100644 --- a/src/common/InputHandler.ts +++ b/src/common/InputHandler.ts @@ -2425,6 +2425,8 @@ export class InputHandler extends Disposable implements IInputHandler { * | 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 | + * | 53 | Overlined. | #Y | + * | 55 | Not Overlined. | #Y | * | 58 | Underline color: Extended color. | #P[Support for RGB and indexed colors, see below.] | * | 90 - 97 | Bright foreground color (analogous to 30 - 37). | #Y | * | 100 - 107 | Bright background color (analogous to 40 - 47). | #Y | From 6188c07bf72a9f084a9ce620b0dfd8529ea20b6b Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sun, 21 May 2023 08:17:06 -0700 Subject: [PATCH 3/3] Serialize overline Fixes #4529 --- addons/xterm-addon-serialize/src/SerializeAddon.ts | 6 +++++- .../test/SerializeAddon.api.ts | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/addons/xterm-addon-serialize/src/SerializeAddon.ts b/addons/xterm-addon-serialize/src/SerializeAddon.ts index b83ff160d1..0279fee89c 100644 --- a/addons/xterm-addon-serialize/src/SerializeAddon.ts +++ b/addons/xterm-addon-serialize/src/SerializeAddon.ts @@ -77,6 +77,7 @@ function equalFlags(cell1: IBufferCell | IAttributeData, cell2: IBufferCell): bo return cell1.isInverse() === cell2.isInverse() && cell1.isBold() === cell2.isBold() && cell1.isUnderline() === cell2.isUnderline() + && cell1.isOverline() === cell2.isOverline() && cell1.isBlink() === cell2.isBlink() && cell1.isInvisible() === cell2.isInvisible() && cell1.isItalic() === cell2.isItalic() @@ -264,6 +265,7 @@ class StringSerializeHandler extends BaseSerializeHandler { if (cell.isInverse() !== oldCell.isInverse()) { sgrSeq.push(cell.isInverse() ? 7 : 27); } if (cell.isBold() !== oldCell.isBold()) { sgrSeq.push(cell.isBold() ? 1 : 22); } if (cell.isUnderline() !== oldCell.isUnderline()) { sgrSeq.push(cell.isUnderline() ? 4 : 24); } + if (cell.isOverline() !== oldCell.isOverline()) { sgrSeq.push(cell.isOverline() ? 53 : 55); } if (cell.isBlink() !== oldCell.isBlink()) { sgrSeq.push(cell.isBlink() ? 5 : 25); } if (cell.isInvisible() !== oldCell.isInvisible()) { sgrSeq.push(cell.isInvisible() ? 8 : 28); } if (cell.isItalic() !== oldCell.isItalic()) { sgrSeq.push(cell.isItalic() ? 3 : 23); } @@ -625,7 +627,9 @@ export class HTMLSerializeHandler extends BaseSerializeHandler { if (cell.isInverse()) { content.push('color: #000000; background-color: #BFBFBF;'); } if (cell.isBold()) { content.push('font-weight: bold;'); } - if (cell.isUnderline()) { content.push('text-decoration: underline;'); } + if (cell.isUnderline() && cell.isOverline()) { content.push('text-decoration: overline underline;'); } + else if (cell.isUnderline()) { content.push('text-decoration: underline;'); } + else if (cell.isOverline()) { content.push('text-decoration: overline;'); } if (cell.isBlink()) { content.push('text-decoration: blink;'); } if (cell.isInvisible()) { content.push('visibility: hidden;'); } if (cell.isItalic()) { content.push('font-style: italic;'); } diff --git a/addons/xterm-addon-serialize/test/SerializeAddon.api.ts b/addons/xterm-addon-serialize/test/SerializeAddon.api.ts index 157b7072fc..5128910a3c 100644 --- a/addons/xterm-addon-serialize/test/SerializeAddon.api.ts +++ b/addons/xterm-addon-serialize/test/SerializeAddon.api.ts @@ -220,6 +220,18 @@ describe('SerializeAddon', () => { assert.equal(await page.evaluate(`serializeAddon.serialize();`), lines.join('\r\n')); }); + it('serialize all rows of content with overline', async () => { + const cols = 10; + const line = '+'.repeat(cols); + const lines: string[] = [ + sgr(OVERLINED) + line, // Overlined + sgr(UNDERLINED) + line, // Overlined, Underlined + sgr(NORMAL) + line // Normal + ]; + await writeSync(page, lines.join('\\r\\n')); + assert.equal(await page.evaluate(`serializeAddon.serialize();`), lines.join('\r\n')); + }); + it('serialize all rows of content with color16 and style separately', async function(): Promise { const cols = 10; const line = '+'.repeat(cols); @@ -601,6 +613,7 @@ const BLINK = '5'; const INVERSE = '7'; const INVISIBLE = '8'; const STRIKETHROUGH = '9'; +const OVERLINED = '53'; const NO_BOLD = '22'; const NO_DIM = '22'; @@ -610,3 +623,4 @@ const NO_BLINK = '25'; const NO_INVERSE = '27'; const NO_INVISIBLE = '28'; const NO_STRIKETHROUGH = '29'; +const NO_OVERLINED = '55';