Merge pull request #5602 from Tyriar/5601

Add SGR 221 and 222
This commit is contained in:
Daniel Imms
2026-01-09 12:21:43 -08:00
committed by GitHub
3 changed files with 30 additions and 2 deletions
+6 -2
View File
@@ -671,7 +671,9 @@ function sgrTest(term: Terminal): void {
{ ps: 47, name: 'Background White' },
{ ps: 49, name: 'Background default' },
{ ps: 53, name: 'Overlined' },
{ ps: 55, name: 'Not overlined' }
{ ps: 55, name: 'Not overlined' },
{ ps: 221, name: 'Not bold (kitty)' },
{ ps: 222, name: 'Not faint (kitty)' }
];
const maxNameLength = entries.reduce<number>((p, c) => Math.max(c.name.length, p), 0);
for (const e of entries) {
@@ -684,7 +686,9 @@ function sgrTest(term: Terminal): void {
const comboEntries: { ps: number[] }[] = [
{ ps: [1, 2, 3, 4, 5, 6, 7, 9] },
{ ps: [2, 41] },
{ ps: [4, 53] }
{ ps: [4, 53] },
{ ps: [1, 2, 221] },
{ ps: [1, 2, 222] }
];
term.write('\n\n\r');
term.writeln(`Combinations`);
+16
View File
@@ -716,6 +716,22 @@ describe('InputHandler', () => {
await inputHandler.parseP('\x1b[22m');
assert.equal(!!inputHandler.curAttrData.isDim(), false);
});
it('SGR 221 resets bold only (kitty)', async () => {
await inputHandler.parseP('\x1b[1;2m');
assert.equal(!!inputHandler.curAttrData.isBold(), true);
assert.equal(!!inputHandler.curAttrData.isDim(), true);
await inputHandler.parseP('\x1b[221m');
assert.equal(!!inputHandler.curAttrData.isBold(), false);
assert.equal(!!inputHandler.curAttrData.isDim(), true);
});
it('SGR 222 resets faint only (kitty)', async () => {
await inputHandler.parseP('\x1b[1;2m');
assert.equal(!!inputHandler.curAttrData.isBold(), true);
assert.equal(!!inputHandler.curAttrData.isDim(), true);
await inputHandler.parseP('\x1b[222m');
assert.equal(!!inputHandler.curAttrData.isBold(), true);
assert.equal(!!inputHandler.curAttrData.isDim(), false);
});
it('italic', async () => {
await inputHandler.parseP('\x1b[3m');
assert.equal(!!inputHandler.curAttrData.isItalic(), true);
+8
View File
@@ -2520,6 +2520,8 @@ export class InputHandler extends Disposable implements IInputHandler {
* | 53 | Overlined. | #Y |
* | 55 | Not Overlined. | #Y |
* | 58 | Underline color: Extended color. | #P[Support for RGB and indexed colors, see below.] |
* | 221 | Not bold (kitty extension). | #Y |
* | 222 | Not faint (kitty extension). | #Y |
* | 90 - 97 | Bright foreground color (analogous to 30 - 37). | #Y |
* | 100 - 107 | Bright background color (analogous to 40 - 47). | #Y |
*
@@ -2652,6 +2654,12 @@ export class InputHandler extends Disposable implements IInputHandler {
} else if (p === 55) {
// not overline
attr.bg &= ~BgFlags.OVERLINE;
} else if (p === 221) {
// not bold (kitty extension)
attr.fg &= ~FgFlags.BOLD;
} else if (p === 222) {
// not faint (kitty extension)
attr.bg &= ~BgFlags.DIM;
} else if (p === 59) {
attr.extended = attr.extended.clone();
attr.extended.underlineColor = -1;