pub struct GridRef<'t> { /* private fields */ }Expand description
Resolved reference to a terminal cell position.
A grid reference is a resolved reference to a specific cell position in
the terminal’s internal page structure. Obtain a grid reference from
Terminal::grid_ref, then extract the cell
or row via GridRef::cell and GridRef::row.
A grid reference is only valid until the next update to the terminal instance. There is no guarantee that a grid reference will remain valid after ANY operation, even if a seemingly unrelated part of the grid is changed, so any information related to the grid reference should be read and cached immediately after obtaining the grid reference.
This API is not meant to be used as the core of render loop. It isn’t built to sustain the framerates needed for rendering large screens. Use the render state API for that.
Implementations§
Source§impl GridRef<'_>
impl GridRef<'_>
Sourcepub fn style(&self) -> Result<Style>
pub fn style(&self) -> Result<Style>
Get the style of the cell at the grid reference’s position.
Sourcepub fn graphemes(&self, buf: &mut [char]) -> Result<usize>
pub fn graphemes(&self, buf: &mut [char]) -> Result<usize>
Get the grapheme cluster codepoints for the cell at the grid reference’s position.
Writes the full grapheme cluster (the cell’s primary codepoint
followed by any combining codepoints) into the provided buffer.
If the cell has no text, Ok(0) is returned.
If the buffer is too small, the function returns
Err(Error::OutOfSpace { required }) where required is the
required number of codepoints. The caller can then retry with
a sufficiently sized buffer.