Skip to content

fix(parser): support ':' sub-parameters in SGR - #245

Open
Heal75 wants to merge 1 commit into
TerminalStudio:masterfrom
Heal75:fix/csi-colon-subparams
Open

Heal75 wants to merge 1 commit into
TerminalStudio:masterfrom
Heal75:fix/csi-colon-subparams

Conversation

@Heal75

@Heal75 Heal75 commented Oct 2, 2026

Copy link
Copy Markdown

The CSI parameter parser drops : and merges the digits around it. ESC[4:0m (underline off) is read as SGR 40, a black background, and the underline is never cleared. ESC[38:2::r:g:bm is misparsed too.

This collects colon-separated sub-parameters (ITU T.416) and maps them to the semicolon forms the handler already understands: 4:0 to 24, 4:N to 4, 38/48:2[:cs]:r:g:b and 38/48:5:n to their ; equivalents. The underline colour (58) is accepted and ignored. Underline styles (curly and so on) are not rendered; they fall back to a plain underline.

Tests cover each form.

The CSI parameter parser dropped ':' and merged the digits around it, so
`ESC[4:0m` (underline off) was read as SGR 40 (black background) and
`ESC[38:2::r:g:bm` was misparsed.

Collect colon-separated sub-parameters (ITU T.416) and map them onto the
semicolon forms the SGR handler already understands: `4:0` -> 24, `4:N` -> 4,
`38/48:2[:cs]:r:g:b` and `38/48:5:n` -> their ';' equivalents. The underline
colour (`58`) is accepted and ignored.
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