pub struct TerminalCellGrid { /* private fields */ }Expand description
Dense cols x rows character cell surface with per-row dirty tracking and row hashes for O(1) unchanged-row diff skipping.
Implementations§
Source§impl TerminalCellGrid
Grid allocation, grapheme-aware wide-char-safe writing, row hashing, box drawing, and plain-text serialization for TerminalCellGrid.
impl TerminalCellGrid
Grid allocation, grapheme-aware wide-char-safe writing, row hashing, box drawing, and plain-text serialization for TerminalCellGrid.
Sourcepub fn reset(&mut self, cols: u16, rows: u16)
pub fn reset(&mut self, cols: u16, rows: u16)
Resizes and clears the grid to cols x rows, reusing existing allocation capacity when dimensions match.
§Arguments
&Self- Mutable grid.u16- Target column count.u16- Target row count.
Sourcepub fn finalize_row_hashes(&mut self)
pub fn finalize_row_hashes(&mut self)
Recomputes FNV-1a row hashes only for rows written during the current projection pass.
§Arguments
&Self- Mutable grid.
Sourcepub fn total_cells(&self) -> usize
pub fn total_cells(&self) -> usize
Sourcepub fn put_cell(&mut self, col: u16, row: u16, cell: TerminalCell) -> u16
pub fn put_cell(&mut self, col: u16, row: u16, cell: TerminalCell) -> u16
Writes a single narrow or wide TerminalCell at (col, row), cleanly clearing overwritten wide neighbors and clipping cleanly at the right edge.
§Arguments
&Self- Mutable grid.u16- Zero-based column coordinate.u16- Zero-based row coordinate.TerminalCell- Cell value to write.
§Returns
u16- Number of columns consumed (0,1, or2).
Sourcepub fn write_styled_text(
&mut self,
col: u16,
row: u16,
max_cols: u16,
text: &str,
style_cell: TerminalCell,
) -> u16
pub fn write_styled_text( &mut self, col: u16, row: u16, max_cols: u16, text: &str, style_cell: TerminalCell, ) -> u16
Writes UTF-8 text onto row starting at col within max_cols, preserving Extended Grapheme Clusters (CJK wide glyphs, combining marks, ZWJ emoji) and clean right-edge truncation.
§Arguments
&Self- Mutable grid.u16- Starting zero-based column coordinate.u16- Target zero-based row coordinate.u16- Maximum display columns allowed for this write.&str- UTF-8 text slice to write.TerminalCell- Style template supplying foreground, background, bold, reverse, and underline flags.
§Returns
u16- Total display columns written.
Sourcepub fn write_text(
&mut self,
col: u16,
row: u16,
max_cols: u16,
text: &str,
) -> u16
pub fn write_text( &mut self, col: u16, row: u16, max_cols: u16, text: &str, ) -> u16
Writes UTF-8 text onto row starting at col using default terminal style within max_cols.
§Arguments
&Self- Mutable grid.u16- Starting zero-based column coordinate.u16- Target zero-based row coordinate.u16- Maximum display columns allowed.&str- UTF-8 text slice to write.
§Returns
u16- Total display columns written.
Sourcepub fn draw_box(
&mut self,
x: u16,
y: u16,
w: u16,
h: u16,
style_cell: TerminalCell,
)
pub fn draw_box( &mut self, x: u16, y: u16, w: u16, h: u16, style_cell: TerminalCell, )
Draws a Unicode box-drawing border frame covering [x, x + w) x [y, y + h).
§Arguments
&Self- Mutable grid.u16- Left column coordinate.u16- Top row coordinate.u16- Box width in columns.u16- Box height in rows.TerminalCell- Style template supplying foreground, background, bold, and reverse flags.