Skip to main content

UnderlineStyle

Enum UnderlineStyle 

Source
#[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.

Trait Implementations§

Source§

impl Clone for UnderlineStyle

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for UnderlineStyle

Source§

impl Debug for UnderlineStyle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for UnderlineStyle

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for UnderlineStyle

Source§

impl Hash for UnderlineStyle

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for UnderlineStyle

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for UnderlineStyle

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.