diff --git a/demo/client/components/window/testWindow.ts b/demo/client/components/window/testWindow.ts index e811ce7866..12c6e99541 100644 --- a/demo/client/components/window/testWindow.ts +++ b/demo/client/components/window/testWindow.ts @@ -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((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`); diff --git a/src/common/InputHandler.test.ts b/src/common/InputHandler.test.ts index ee12e9a061..751cfcf18d 100644 --- a/src/common/InputHandler.test.ts +++ b/src/common/InputHandler.test.ts @@ -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); diff --git a/src/common/InputHandler.ts b/src/common/InputHandler.ts index f816e1141c..3076ed8a9e 100644 --- a/src/common/InputHandler.ts +++ b/src/common/InputHandler.ts @@ -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;