Skip to content

Commit 6188c07

Browse files
committed
Serialize overline
Fixes #4529
1 parent 325d133 commit 6188c07

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

addons/xterm-addon-serialize/src/SerializeAddon.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ function equalFlags(cell1: IBufferCell | IAttributeData, cell2: IBufferCell): bo
7777
return cell1.isInverse() === cell2.isInverse()
7878
&& cell1.isBold() === cell2.isBold()
7979
&& cell1.isUnderline() === cell2.isUnderline()
80+
&& cell1.isOverline() === cell2.isOverline()
8081
&& cell1.isBlink() === cell2.isBlink()
8182
&& cell1.isInvisible() === cell2.isInvisible()
8283
&& cell1.isItalic() === cell2.isItalic()
@@ -264,6 +265,7 @@ class StringSerializeHandler extends BaseSerializeHandler {
264265
if (cell.isInverse() !== oldCell.isInverse()) { sgrSeq.push(cell.isInverse() ? 7 : 27); }
265266
if (cell.isBold() !== oldCell.isBold()) { sgrSeq.push(cell.isBold() ? 1 : 22); }
266267
if (cell.isUnderline() !== oldCell.isUnderline()) { sgrSeq.push(cell.isUnderline() ? 4 : 24); }
268+
if (cell.isOverline() !== oldCell.isOverline()) { sgrSeq.push(cell.isOverline() ? 53 : 55); }
267269
if (cell.isBlink() !== oldCell.isBlink()) { sgrSeq.push(cell.isBlink() ? 5 : 25); }
268270
if (cell.isInvisible() !== oldCell.isInvisible()) { sgrSeq.push(cell.isInvisible() ? 8 : 28); }
269271
if (cell.isItalic() !== oldCell.isItalic()) { sgrSeq.push(cell.isItalic() ? 3 : 23); }
@@ -625,7 +627,9 @@ export class HTMLSerializeHandler extends BaseSerializeHandler {
625627

626628
if (cell.isInverse()) { content.push('color: #000000; background-color: #BFBFBF;'); }
627629
if (cell.isBold()) { content.push('font-weight: bold;'); }
628-
if (cell.isUnderline()) { content.push('text-decoration: underline;'); }
630+
if (cell.isUnderline() && cell.isOverline()) { content.push('text-decoration: overline underline;'); }
631+
else if (cell.isUnderline()) { content.push('text-decoration: underline;'); }
632+
else if (cell.isOverline()) { content.push('text-decoration: overline;'); }
629633
if (cell.isBlink()) { content.push('text-decoration: blink;'); }
630634
if (cell.isInvisible()) { content.push('visibility: hidden;'); }
631635
if (cell.isItalic()) { content.push('font-style: italic;'); }

addons/xterm-addon-serialize/test/SerializeAddon.api.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,18 @@ describe('SerializeAddon', () => {
220220
assert.equal(await page.evaluate(`serializeAddon.serialize();`), lines.join('\r\n'));
221221
});
222222

223+
it('serialize all rows of content with overline', async () => {
224+
const cols = 10;
225+
const line = '+'.repeat(cols);
226+
const lines: string[] = [
227+
sgr(OVERLINED) + line, // Overlined
228+
sgr(UNDERLINED) + line, // Overlined, Underlined
229+
sgr(NORMAL) + line // Normal
230+
];
231+
await writeSync(page, lines.join('\\r\\n'));
232+
assert.equal(await page.evaluate(`serializeAddon.serialize();`), lines.join('\r\n'));
233+
});
234+
223235
it('serialize all rows of content with color16 and style separately', async function(): Promise<any> {
224236
const cols = 10;
225237
const line = '+'.repeat(cols);
@@ -601,6 +613,7 @@ const BLINK = '5';
601613
const INVERSE = '7';
602614
const INVISIBLE = '8';
603615
const STRIKETHROUGH = '9';
616+
const OVERLINED = '53';
604617

605618
const NO_BOLD = '22';
606619
const NO_DIM = '22';
@@ -610,3 +623,4 @@ const NO_BLINK = '25';
610623
const NO_INVERSE = '27';
611624
const NO_INVISIBLE = '28';
612625
const NO_STRIKETHROUGH = '29';
626+
const NO_OVERLINED = '55';

0 commit comments

Comments
 (0)