Commit graph

1 commit

Author SHA1 Message Date
Vadim Peretokin
a229206d4c
fix: colon-form underline styles now match other terminals (#9498)
#### Brief overview of PR changes/additions

Corrects the SGR colon-form underline sub-parameter decode (`ESC[4:Nm`)
in `TBuffer::decodeSGR()` to match the widely-adopted kitty/VTE
convention that other terminals use:

| Sequence | Meaning (kitty/VTE) | Before | After |
| --- | --- | --- | --- |
| `4:0` | no underline | none | none |
| `4:1` | single/straight | single | single |
| `4:2` | double | dashed | single* |
| `4:3` | curly/wavy | dotted | curly/wavy |
| `4:4` | dotted | wavy | dotted |
| `4:5` | dashed | **cleared the underline** | dashed |

\* Mudlet has no distinct double-underline style, so `4:2` is shown as a
plain single underline.

Adds `SgrUnderlineStyleTest` (functional test) covering `4:0`-`4:5` from
a clean pen, style-to-style transitions (verifying sibling flags are
cleared), the out-of-range/`default` fallback, and that plain `ESC[4m`
still yields a single underline.

#### Motivation for adding to Mudlet

The colon sub-parameter mapping introduced in #8262 was shifted relative
to the kitty/VTE convention, so text a game sent with these styles
rendered as the wrong underline style. Most visibly, `4:5` (dashed)
wrongly cleared the underline entirely instead of drawing a dashed line.
This makes Mudlet match what other terminals do for these codes.

#### Other info (issues closed, discussion etc)

Relates to #8262 (which introduced the colon-form underline support).

Note: the plain numeric `ESC[4m` handler is intentionally left unchanged
here; there is a pre-existing, separate quirk that a plain `ESC[4m`
following a colon style does not clear the sibling style flags. That is
out of scope for this fix and could be addressed independently.

Assisted-by: Claude:claude-opus-4-8
2026-07-29 09:50:56 +02:00