#[repr(u8)]pub enum UnderlineStyle {
None = 0,
Single = 1,
Double = 2,
Curly = 3,
Dotted = 4,
Dashed = 5,
}Expand description
How a cell’s underline is drawn — SGR 4 : Ps.
This is the storage, and None is a member of it. There is no second boolean saying
whether the cell is underlined: CellFlags::UNDERLINE survives as a derived view bit so
existing consumers keep working, and the style is its only writer. So the two cannot disagree —
which is not a stylistic preference but the defect three of the four references demonstrably
pay for. alacritty’s display layer inserts a plain UNDERLINE over a cell that already carries
a curl and its renderer draws both rects; xterm.js has two readers that resolve the same
conflict in opposite directions, pinned by a test; xterm leaves both bits set after
CSI 4m; CSI 21m and lets each consumer pick a resolution. ghostty is the one where it is not
representable — its underline is an enum(u3) with none among the members and there is no
underline: bool — and that is the shape here.
Stored in the content word (bits 26..=28), not in a row side map: the packed cell is not
full, so the side-map
invariant
does not apply, and packing is what makes the style ride along for free everywhere a cell
moves — reflow, scroll, and the blank a wrapping wide glyph leaves behind. One path needed an
explicit carry and is worth naming rather than counting in: promote_cluster_to_wide /
relocate_cluster_wide synthesise the pair’s spacer from the pen rather than moving it, so
they take the style from the lead the same way they already take its extended attrs (ADR-0025
D4). A refuting pass found that one; the other three are free.
Variants§
None = 0
Not underlined. The absence is a member rather than a separate flag.
Single = 1
SGR 4 or 4:1 — one straight line.
Double = 2
Two straight lines — 4:2, and also the legacy SGR 21, which is the only value with
a second spelling. Both land on this field, so SGR 24 clears either of them.
The legacy form is not unanimous in the prior art and the spec is what settles it: vte
reads 21 as cancel bold, so an application meaning “stop bold” gets a double underline
here and keeps its bold. SGR 22 is the arm that cancels bold.
Curly = 3
4:3 — a curl.
Dotted = 4
4:4 — a dotted line. Drawn with a whole number of dots per cell, so the pattern
does not restart at a cell boundary.
Dashed = 5
4:5 — a dashed line. One period per cell, with the dash split across the boundary
so adjacent cells’ dashes join.