Skip to content

fix(parser): ignore CSI sequences with a private prefix in SGR - #244

Open
Heal75 wants to merge 1 commit into
TerminalStudio:masterfrom
Heal75:fix/ignore-private-prefix-sgr
Open

Heal75 wants to merge 1 commit into
TerminalStudio:masterfrom
Heal75:fix/ignore-private-prefix-sgr

Conversation

@Heal75

@Heal75 Heal75 commented Oct 2, 2026

Copy link
Copy Markdown

CSI > Ps m (XTMODKEYS, used to enable modifyOtherKeys) and CSI ? Ps m reach the SGR handler with the prefix discarded. ESC[>4m is therefore executed as SGR 4, which turns underline on for everything printed afterwards.

Programs that request modifyOtherKeys at startup trigger this. In my case Claude Code (a TUI) renders fully underlined, including blank cells, and the underline never clears.

This returns early from the SGR handler when the sequence has a prefix. Tests cover >, ? and plain ESC[4m, so SGR itself still works.

`CSI > Ps m` (XTMODKEYS, used to enable modifyOtherKeys) and `CSI ? Ps m`
reached the SGR handler with the prefix dropped, so `ESC[>4m` was executed as
SGR 4 and switched underline on for everything printed afterwards.

Return early from the SGR handler when the sequence has a prefix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant