pub struct Cell { /* private fields */ }Expand description
One character position: a base glyph, fg/bg colour references, and flags.
Combining marks (#45) and an OSC 8 hyperlink (#46) attach via per-row maps,
signalled by the COMBINED_PRESENT / LINK_PRESENT bits — the cell itself is
three packed words, no Option field. All access is through the accessor seam
(#44); construct with Cell::from_parts or Cell::default.
Eq is a derived bitwise compare, which is exact because the packing is
canonical — every logical cell maps to one bit pattern (unused bits stay 0).
Implementations§
Source§impl Cell
impl Cell
Sourcepub fn from_parts(c: char, fg: Color, bg: Color, flags: CellFlags) -> Self
pub fn from_parts(c: char, fg: Color, bg: Color, flags: CellFlags) -> Self
Assemble a cell from its logical parts. The single construction seam —
Pen::cell and the wire decoder funnel through here, so the bit-packing
lives in exactly one place (#44).
Sourcepub fn flags(&self) -> CellFlags
pub fn flags(&self) -> CellFlags
The cell’s flags (SGR attributes + layout markers), reassembled from the
three words — the branchless inverse of Cell::store_flags.
Sourcepub fn is_combined(&self) -> bool
pub fn is_combined(&self) -> bool
Does this column carry combining marks? When true, the cluster lives in the row’s combining map at this column (#45) — a flag-gated cache: never read the map without first checking this bit.
Sourcepub fn is_linked(&self) -> bool
pub fn is_linked(&self) -> bool
Does this column carry an OSC 8 hyperlink? When true, the hyperlink-pool index lives in the row’s link map at this column (#46) — flag-gated like combining: never read the link map without first checking this bit.
Sourcepub fn is_ucolored(&self) -> bool
pub fn is_ucolored(&self) -> bool
Does this column carry a non-default underline colour (SGR 58, #520)? When
true, the Color reference lives in the row’s ucolor map at this column —
flag-gated exactly like the hyperlink: never read the ucolor map without
first checking this bit.
Sourcepub fn set_bg(&mut self, bg: Color)
pub fn set_bg(&mut self, bg: Color)
Overwrite the background colour (the BCE erase fill, #16), preserving the bg-word flag bits.
Sourcepub fn set_combined(&mut self, on: bool)
pub fn set_combined(&mut self, on: bool)
Mark (or unmark) this column as carrying combining marks in the row map.
Sourcepub fn set_linked(&mut self, on: bool)
pub fn set_linked(&mut self, on: bool)
Mark (or unmark) this column as carrying an OSC 8 hyperlink in the row map.
Sourcepub fn set_ucolored(&mut self, on: bool)
pub fn set_ucolored(&mut self, on: bool)
Mark (or unmark) this column as carrying a non-default underline colour in
the row’s ucolor map (#520). Mirror of Cell::set_linked.
Sourcepub fn insert_flags(&mut self, flags: CellFlags)
pub fn insert_flags(&mut self, flags: CellFlags)
Add the given flags (leaving the others set). Sets the word bits directly —
no round-trip through flags()/store_flags.
Sourcepub fn remove_flags(&mut self, flags: CellFlags)
pub fn remove_flags(&mut self, flags: CellFlags)
Clear the given flags (leaving the others as they are).
Sourcepub fn is_wide(&self) -> bool
pub fn is_wide(&self) -> bool
Is this the lead cell of a width-2 glyph? Direct content-bit query — the
hot overwrite/erase/reflow paths use this instead of reconstructing the
full flags() to test one marker.
Sourcepub fn is_wide_spacer(&self) -> bool
pub fn is_wide_spacer(&self) -> bool
Is this the trailing spacer cell of a width-2 glyph?
Sourcepub fn is_leading_spacer(&self) -> bool
pub fn is_leading_spacer(&self) -> bool
Is this the blank column vacated when a wide glyph wrapped off the right edge (#113)? It holds no character; unlike a trailing spacer it has no wide lead to its left, so only the text extractors skip it.
Sourcepub fn is_spacer(&self) -> bool
pub fn is_spacer(&self) -> bool
Does this column hold no text — either half of a wide glyph’s trailing spacer or a wide-wrap leading spacer? Used by the text extractors (search, selection text, logical lines) to skip non-character columns.
Sourcepub fn set_leading_spacer(&mut self)
pub fn set_leading_spacer(&mut self)
Mark this (blank) column as the leading spacer of a wrapped wide glyph.
Sourcepub fn is_wrapline(&self) -> bool
pub fn is_wrapline(&self) -> bool
Did this row soft-wrap into the next (WRAPLINE on its last cell)?