pub struct Grid { /* private fields */ }Expand description
The current screen: rows × cols cells.
Implementations§
Source§impl Grid
impl Grid
pub fn cols(&self) -> usize
pub fn rows(&self) -> usize
Sourcepub fn is_row_wrapped(&self, row: usize) -> bool
pub fn is_row_wrapped(&self, row: usize) -> bool
Did row soft-wrap (auto-wrap) into the next one — i.e. are the two rows one logical
line?
Ask this, not the last cell’s WRAPLINE flag: soft-wrap is a property of the row and is
stored there, so a cell never carries it on a live grid (#538). The flag still appears on
the wire, derived onto a span’s last cell at encode time, which is a different layer —
see docs/architecture.md §Cell on the two things called “cell” here.
Sourcepub fn cell(&self, row: usize, col: usize) -> &Cell
pub fn cell(&self, row: usize, col: usize) -> &Cell
Read a cell. Panics on out-of-bounds (callers clamp to the grid).
Sourcepub fn scroll_up_region(&mut self, top: usize, bottom: usize)
pub fn scroll_up_region(&mut self, top: usize, bottom: usize)
Scroll the rows [top..=bottom] up by one line: the top line of the
region is dropped and a blank line appears at bottom. Rows outside the
region are untouched.
rotate_left moves whole-row Vec handles (24 bytes each), not cell
data — cheap even at the screen’s bounded row count, so the per-newline
scrollback cost lives in the eviction, not here (see scroll_up_recycle
and ADR-0009).
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Reset every cell to a blank default. Used when switching to the alt screen (which always starts cleared).
Sourcepub fn scroll_down_region(&mut self, top: usize, bottom: usize)
pub fn scroll_down_region(&mut self, top: usize, bottom: usize)
Scroll the rows [top..=bottom] down by one line: a blank line appears at
top and the bottom region line is dropped. Rows outside are untouched.
Used by RI (reverse index) at the top margin.