pub struct Cell {
pub flags: CellFlags,
pub attrs: SgrAttrs,
pub hyperlink: HyperlinkId,
/* private fields */
}Expand description
A single cell in the terminal grid.
Fields§
§flags: CellFlagsCell-level flags (wide char, continuation, etc.).
attrs: SgrAttrsSGR text attributes.
hyperlink: HyperlinkIdHyperlink ID (0 = no link).
Implementations§
Source§impl Cell
impl Cell
Sourcepub fn new(ch: char) -> Self
pub fn new(ch: char) -> Self
Create a new cell with the given character and default attributes.
Sourcepub fn with_attrs(ch: char, width: u8, attrs: SgrAttrs) -> Self
pub fn with_attrs(ch: char, width: u8, attrs: SgrAttrs) -> Self
Create a new cell with the given character, width, and attributes.
Sourcepub fn wide(ch: char, attrs: SgrAttrs) -> (Self, Self)
pub fn wide(ch: char, attrs: SgrAttrs) -> (Self, Self)
Create a wide (2-column) character cell.
Returns (leading, continuation) pair. The leading cell holds the
character; the continuation cell is a placeholder.
Sourcepub fn is_wide_continuation(&self) -> bool
pub fn is_wide_continuation(&self) -> bool
Whether this cell is a continuation (trailing half) of a wide character.
Sourcepub fn set_content(&mut self, ch: char, width: u8)
pub fn set_content(&mut self, ch: char, width: u8)
Set the character content and display width.
Sourcepub fn erase(&mut self, bg: Color)
pub fn erase(&mut self, bg: Color)
Reset this cell to a blank space with the given background attributes.
Used by erase operations (ED, EL, ECH) which fill with the current background color but reset all other attributes.
Sourcepub fn push_combining(&mut self, mark: char) -> bool
pub fn push_combining(&mut self, mark: char) -> bool
Append a combining mark to this cell’s grapheme cluster.
Returns true if the mark was stored, false if the inline buffer
is full (excess marks are silently dropped).
Sourcepub fn combining_marks(&self) -> &[char]
pub fn combining_marks(&self) -> &[char]
The combining marks attached to this cell’s base character.
Sourcepub fn has_combining(&self) -> bool
pub fn has_combining(&self) -> bool
Whether this cell has any combining marks.
Sourcepub fn display_width(ch: char) -> u8
pub fn display_width(ch: char) -> u8
Compute terminal display width for a single Unicode scalar.
Returns:
0for non-spacing marks/format controls (combining marks, ZWJ, VS16, etc.)1for narrow characters2for wide characters (CJK, emoji presentation)
Widths above 2 are clamped to 2 for terminal cell semantics.