mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
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.isInvisible() === cell2.isInvisible()
|
||||
&& cell1.isItalic() === cell2.isItalic()
|
||||
&& cell1.isDim() === cell2.isDim();
|
||||
&& cell1.isDim() === cell2.isDim()
|
||||
&& cell1.isStrikethrough() === cell2.isStrikethrough();
|
||||
}
|
||||
|
||||
class StringSerializeHandler extends BaseSerializeHandler {
|
||||
@@ -160,7 +161,7 @@ class StringSerializeHandler extends BaseSerializeHandler {
|
||||
if (
|
||||
// you must output character to cause overflow, control sequence can't do this
|
||||
nextRowFirstChar.getChars() &&
|
||||
isNextRowFirstCharDoubleWidth ? this._nullCellCount <= 1 : this._nullCellCount <= 0
|
||||
isNextRowFirstCharDoubleWidth ? this._nullCellCount <= 1 : this._nullCellCount <= 0
|
||||
) {
|
||||
if (
|
||||
// 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.isItalic() !== oldCell.isItalic()) { sgrSeq.push(cell.isItalic() ? 3 : 23); }
|
||||
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(BLINK) + line,
|
||||
sgr(INVISIBLE) + line,
|
||||
sgr(STRIKETHROUGH) + line,
|
||||
sgr(NO_INVERSE) + line,
|
||||
sgr(NO_BOLD) + line,
|
||||
sgr(NO_UNDERLINED) + line,
|
||||
sgr(NO_BLINK) + line,
|
||||
sgr(NO_INVISIBLE) + line
|
||||
sgr(NO_INVISIBLE) + line,
|
||||
sgr(NO_STRIKETHROUGH) + line
|
||||
];
|
||||
const rows = lines.length;
|
||||
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_RESET = '49';
|
||||
|
||||
const INVERSE = '7';
|
||||
const BOLD = '1';
|
||||
const DIM = '2';
|
||||
const ITALIC = '3';
|
||||
const UNDERLINED = '4';
|
||||
const BLINK = '5';
|
||||
const INVERSE = '7';
|
||||
const INVISIBLE = '8';
|
||||
const STRIKETHROUGH = '9';
|
||||
|
||||
const NO_INVERSE = '27';
|
||||
const NO_BOLD = '22';
|
||||
const NO_DIM = '22';
|
||||
const NO_ITALIC = '23';
|
||||
const NO_UNDERLINED = '24';
|
||||
const NO_BLINK = '25';
|
||||
const NO_INVERSE = '27';
|
||||
const NO_INVISIBLE = '28';
|
||||
|
||||
const ITALIC = '3';
|
||||
const DIM = '2';
|
||||
|
||||
const NO_ITALIC = '23';
|
||||
const NO_DIM = '22';
|
||||
const NO_STRIKETHROUGH = '29';
|
||||
|
||||
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
|
||||
* which renders all characters using the font. The default is true.
|
||||
*/
|
||||
customGlyphs?: boolean;
|
||||
customGlyphs?: boolean;
|
||||
|
||||
/**
|
||||
* Whether input should be disabled.
|
||||
@@ -1085,18 +1085,20 @@ declare module 'xterm-headless' {
|
||||
|
||||
/** Whether the cell has the bold attribute (CSI 1 m). */
|
||||
isBold(): number;
|
||||
/** Whether the cell has the inverse attribute (CSI 3 m). */
|
||||
/** Whether the cell has the italic attribute (CSI 3 m). */
|
||||
isItalic(): number;
|
||||
/** Whether the cell has the inverse attribute (CSI 2 m). */
|
||||
/** Whether the cell has the dim attribute (CSI 2 m). */
|
||||
isDim(): number;
|
||||
/** Whether the cell has the underline attribute (CSI 4 m). */
|
||||
isUnderline(): number;
|
||||
/** Whether the cell has the inverse attribute (CSI 5 m). */
|
||||
/** Whether the cell has the blink attribute (CSI 5 m). */
|
||||
isBlink(): number;
|
||||
/** Whether the cell has the inverse attribute (CSI 7 m). */
|
||||
isInverse(): number;
|
||||
/** Whether the cell has the inverse attribute (CSI 8 m). */
|
||||
/** Whether the cell has the invisible attribute (CSI 8 m). */
|
||||
isInvisible(): number;
|
||||
/** Whether the cell has the strikethrough attribute (CSI 9 m). */
|
||||
isStrikethrough(): number;
|
||||
|
||||
/** Whether the cell is using the RGB foreground color mode. */
|
||||
isFgRGB(): boolean;
|
||||
|
||||
Vendored
+6
-4
@@ -1444,18 +1444,20 @@ declare module 'xterm' {
|
||||
|
||||
/** Whether the cell has the bold attribute (CSI 1 m). */
|
||||
isBold(): number;
|
||||
/** Whether the cell has the inverse attribute (CSI 3 m). */
|
||||
/** Whether the cell has the italic attribute (CSI 3 m). */
|
||||
isItalic(): number;
|
||||
/** Whether the cell has the inverse attribute (CSI 2 m). */
|
||||
/** Whether the cell has the dim attribute (CSI 2 m). */
|
||||
isDim(): number;
|
||||
/** Whether the cell has the underline attribute (CSI 4 m). */
|
||||
isUnderline(): number;
|
||||
/** Whether the cell has the inverse attribute (CSI 5 m). */
|
||||
/** Whether the cell has the blink attribute (CSI 5 m). */
|
||||
isBlink(): number;
|
||||
/** Whether the cell has the inverse attribute (CSI 7 m). */
|
||||
isInverse(): number;
|
||||
/** Whether the cell has the inverse attribute (CSI 8 m). */
|
||||
/** Whether the cell has the invisible attribute (CSI 8 m). */
|
||||
isInvisible(): number;
|
||||
/** Whether the cell has the strikethrough attribute (CSI 9 m). */
|
||||
isStrikethrough(): number;
|
||||
|
||||
/** Whether the cell is using the RGB foreground color mode. */
|
||||
isFgRGB(): boolean;
|
||||
|
||||
Reference in New Issue
Block a user