Skip to content

Commit b710f1e

Browse files
fix: add SGR 221/222 kitty bold/faint individual reset
Handle SGR 221 (reset bold only) and SGR 222 (reset faint/dim only) as kitty terminal extensions. Standard SGR 22 resets both simultaneously; these codes allow independent control. Fixes #32 Co-authored-by: Ona <no-reply@ona.com>
1 parent 08e2ae0 commit b710f1e

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

inputhandler_sgr.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,14 @@ func (h *InputHandler) charAttributes(params *Params) bool {
145145
attr.Extended = attr.extended().Clone()
146146
attr.Extended.SetUnderlineColor(0)
147147
attr.UpdateExtended()
148+
149+
case p == 221:
150+
// kitty extension: reset bold only (leaves faint intact)
151+
attr.Fg &^= FgFlagBold
152+
153+
case p == 222:
154+
// kitty extension: reset faint/dim only (leaves bold intact)
155+
attr.Bg &^= BgFlagDim
148156
}
149157
}
150158
return true

inputhandler_sgr_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,3 +547,4 @@ func TestSGR_MultipleResets(t *testing.T) {
547547
t.Errorf("bg not reset: got %08x, want %08x", h.curAttrData.Bg&bgMask, def.Bg&bgMask)
548548
}
549549
}
550+

0 commit comments

Comments
 (0)