Merge pull request #3480 from silamon/strikethrough-serialize
Support strikethrough in serialize addon
This commit is contained in:
@@ -72,7 +72,8 @@ function equalFlags(cell1: IBufferCell, cell2: IBufferCell): boolean {
|
|||||||
&& cell1.isBlink() === cell2.isBlink()
|
&& cell1.isBlink() === cell2.isBlink()
|
||||||
&& cell1.isInvisible() === cell2.isInvisible()
|
&& cell1.isInvisible() === cell2.isInvisible()
|
||||||
&& cell1.isItalic() === cell2.isItalic()
|
&& cell1.isItalic() === cell2.isItalic()
|
||||||
&& cell1.isDim() === cell2.isDim();
|
&& cell1.isDim() === cell2.isDim()
|
||||||
|
&& cell1.isStrikethrough() === cell2.isStrikethrough();
|
||||||
}
|
}
|
||||||
|
|
||||||
class StringSerializeHandler extends BaseSerializeHandler {
|
class StringSerializeHandler extends BaseSerializeHandler {
|
||||||
@@ -160,7 +161,7 @@ class StringSerializeHandler extends BaseSerializeHandler {
|
|||||||
if (
|
if (
|
||||||
// you must output character to cause overflow, control sequence can't do this
|
// you must output character to cause overflow, control sequence can't do this
|
||||||
nextRowFirstChar.getChars() &&
|
nextRowFirstChar.getChars() &&
|
||||||
isNextRowFirstCharDoubleWidth ? this._nullCellCount <= 1 : this._nullCellCount <= 0
|
isNextRowFirstCharDoubleWidth ? this._nullCellCount <= 1 : this._nullCellCount <= 0
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
// the last character can't be null,
|
// the last character can't be null,
|
||||||
@@ -259,6 +260,7 @@ class StringSerializeHandler extends BaseSerializeHandler {
|
|||||||
if (cell.isInvisible() !== oldCell.isInvisible()) { sgrSeq.push(cell.isInvisible() ? 8 : 28); }
|
if (cell.isInvisible() !== oldCell.isInvisible()) { sgrSeq.push(cell.isInvisible() ? 8 : 28); }
|
||||||
if (cell.isItalic() !== oldCell.isItalic()) { sgrSeq.push(cell.isItalic() ? 3 : 23); }
|
if (cell.isItalic() !== oldCell.isItalic()) { sgrSeq.push(cell.isItalic() ? 3 : 23); }
|
||||||
if (cell.isDim() !== oldCell.isDim()) { sgrSeq.push(cell.isDim() ? 2 : 22); }
|
if (cell.isDim() !== oldCell.isDim()) { sgrSeq.push(cell.isDim() ? 2 : 22); }
|
||||||
|
if (cell.isStrikethrough() !== oldCell.isStrikethrough()) { sgrSeq.push(cell.isStrikethrough() ? 9 : 29); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,11 +196,13 @@ describe('SerializeAddon', () => {
|
|||||||
sgr(UNDERLINED) + line,
|
sgr(UNDERLINED) + line,
|
||||||
sgr(BLINK) + line,
|
sgr(BLINK) + line,
|
||||||
sgr(INVISIBLE) + line,
|
sgr(INVISIBLE) + line,
|
||||||
|
sgr(STRIKETHROUGH) + line,
|
||||||
sgr(NO_INVERSE) + line,
|
sgr(NO_INVERSE) + line,
|
||||||
sgr(NO_BOLD) + line,
|
sgr(NO_BOLD) + line,
|
||||||
sgr(NO_UNDERLINED) + line,
|
sgr(NO_UNDERLINED) + line,
|
||||||
sgr(NO_BLINK) + line,
|
sgr(NO_BLINK) + line,
|
||||||
sgr(NO_INVISIBLE) + line
|
sgr(NO_INVISIBLE) + line,
|
||||||
|
sgr(NO_STRIKETHROUGH) + line
|
||||||
];
|
];
|
||||||
const rows = lines.length;
|
const rows = lines.length;
|
||||||
await writeSync(page, lines.join('\\r\\n'));
|
await writeSync(page, lines.join('\\r\\n'));
|
||||||
@@ -591,20 +593,20 @@ const BG_RGB_GREEN = '48;2;0;255;0';
|
|||||||
const BG_RGB_YELLOW = '48;2;255;255;0';
|
const BG_RGB_YELLOW = '48;2;255;255;0';
|
||||||
const BG_RESET = '49';
|
const BG_RESET = '49';
|
||||||
|
|
||||||
const INVERSE = '7';
|
|
||||||
const BOLD = '1';
|
const BOLD = '1';
|
||||||
|
const DIM = '2';
|
||||||
|
const ITALIC = '3';
|
||||||
const UNDERLINED = '4';
|
const UNDERLINED = '4';
|
||||||
const BLINK = '5';
|
const BLINK = '5';
|
||||||
|
const INVERSE = '7';
|
||||||
const INVISIBLE = '8';
|
const INVISIBLE = '8';
|
||||||
|
const STRIKETHROUGH = '9';
|
||||||
|
|
||||||
const NO_INVERSE = '27';
|
|
||||||
const NO_BOLD = '22';
|
const NO_BOLD = '22';
|
||||||
|
const NO_DIM = '22';
|
||||||
|
const NO_ITALIC = '23';
|
||||||
const NO_UNDERLINED = '24';
|
const NO_UNDERLINED = '24';
|
||||||
const NO_BLINK = '25';
|
const NO_BLINK = '25';
|
||||||
|
const NO_INVERSE = '27';
|
||||||
const NO_INVISIBLE = '28';
|
const NO_INVISIBLE = '28';
|
||||||
|
const NO_STRIKETHROUGH = '29';
|
||||||
const ITALIC = '3';
|
|
||||||
const DIM = '2';
|
|
||||||
|
|
||||||
const NO_ITALIC = '23';
|
|
||||||
const NO_DIM = '22';
|
|
||||||
|
|||||||
Vendored
+7
-5
@@ -84,7 +84,7 @@ declare module 'xterm-headless' {
|
|||||||
* line height and letter spacing is used. Note that this doesn't work with the DOM renderer
|
* line height and letter spacing is used. Note that this doesn't work with the DOM renderer
|
||||||
* which renders all characters using the font. The default is true.
|
* which renders all characters using the font. The default is true.
|
||||||
*/
|
*/
|
||||||
customGlyphs?: boolean;
|
customGlyphs?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether input should be disabled.
|
* Whether input should be disabled.
|
||||||
@@ -1085,18 +1085,20 @@ declare module 'xterm-headless' {
|
|||||||
|
|
||||||
/** Whether the cell has the bold attribute (CSI 1 m). */
|
/** Whether the cell has the bold attribute (CSI 1 m). */
|
||||||
isBold(): number;
|
isBold(): number;
|
||||||
/** Whether the cell has the inverse attribute (CSI 3 m). */
|
/** Whether the cell has the italic attribute (CSI 3 m). */
|
||||||
isItalic(): number;
|
isItalic(): number;
|
||||||
/** Whether the cell has the inverse attribute (CSI 2 m). */
|
/** Whether the cell has the dim attribute (CSI 2 m). */
|
||||||
isDim(): number;
|
isDim(): number;
|
||||||
/** Whether the cell has the underline attribute (CSI 4 m). */
|
/** Whether the cell has the underline attribute (CSI 4 m). */
|
||||||
isUnderline(): number;
|
isUnderline(): number;
|
||||||
/** Whether the cell has the inverse attribute (CSI 5 m). */
|
/** Whether the cell has the blink attribute (CSI 5 m). */
|
||||||
isBlink(): number;
|
isBlink(): number;
|
||||||
/** Whether the cell has the inverse attribute (CSI 7 m). */
|
/** Whether the cell has the inverse attribute (CSI 7 m). */
|
||||||
isInverse(): number;
|
isInverse(): number;
|
||||||
/** Whether the cell has the inverse attribute (CSI 8 m). */
|
/** Whether the cell has the invisible attribute (CSI 8 m). */
|
||||||
isInvisible(): number;
|
isInvisible(): number;
|
||||||
|
/** Whether the cell has the strikethrough attribute (CSI 9 m). */
|
||||||
|
isStrikethrough(): number;
|
||||||
|
|
||||||
/** Whether the cell is using the RGB foreground color mode. */
|
/** Whether the cell is using the RGB foreground color mode. */
|
||||||
isFgRGB(): boolean;
|
isFgRGB(): boolean;
|
||||||
|
|||||||
Vendored
+6
-4
@@ -1444,18 +1444,20 @@ declare module 'xterm' {
|
|||||||
|
|
||||||
/** Whether the cell has the bold attribute (CSI 1 m). */
|
/** Whether the cell has the bold attribute (CSI 1 m). */
|
||||||
isBold(): number;
|
isBold(): number;
|
||||||
/** Whether the cell has the inverse attribute (CSI 3 m). */
|
/** Whether the cell has the italic attribute (CSI 3 m). */
|
||||||
isItalic(): number;
|
isItalic(): number;
|
||||||
/** Whether the cell has the inverse attribute (CSI 2 m). */
|
/** Whether the cell has the dim attribute (CSI 2 m). */
|
||||||
isDim(): number;
|
isDim(): number;
|
||||||
/** Whether the cell has the underline attribute (CSI 4 m). */
|
/** Whether the cell has the underline attribute (CSI 4 m). */
|
||||||
isUnderline(): number;
|
isUnderline(): number;
|
||||||
/** Whether the cell has the inverse attribute (CSI 5 m). */
|
/** Whether the cell has the blink attribute (CSI 5 m). */
|
||||||
isBlink(): number;
|
isBlink(): number;
|
||||||
/** Whether the cell has the inverse attribute (CSI 7 m). */
|
/** Whether the cell has the inverse attribute (CSI 7 m). */
|
||||||
isInverse(): number;
|
isInverse(): number;
|
||||||
/** Whether the cell has the inverse attribute (CSI 8 m). */
|
/** Whether the cell has the invisible attribute (CSI 8 m). */
|
||||||
isInvisible(): number;
|
isInvisible(): number;
|
||||||
|
/** Whether the cell has the strikethrough attribute (CSI 9 m). */
|
||||||
|
isStrikethrough(): number;
|
||||||
|
|
||||||
/** Whether the cell is using the RGB foreground color mode. */
|
/** Whether the cell is using the RGB foreground color mode. */
|
||||||
isFgRGB(): boolean;
|
isFgRGB(): boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user