pub struct RegionScreen { /* private fields */ }Expand description
A bounded per-region virtual terminal.
Feed a child’s raw output bytes with feed; ANSI cursor,
erase, scroll, and color sequences are applied to a fixed rows × cols cell
grid rather than passed through, so a child that redraws in place renders
correctly and can never move the host terminal’s cursor. Content past the
last column truncates (the region does not auto-wrap). Rows that scroll off
the top are returned so the caller can retain a bounded tail for a failure
replay; on success they are simply dropped.
Implementations§
Source§impl RegionScreen
impl RegionScreen
Sourcepub fn new(rows: usize, cols: usize) -> Self
pub fn new(rows: usize, cols: usize) -> Self
Create a screen over a fresh rows × cols grid (each clamped to ≥ 1).
Sourcepub fn feed(&mut self, bytes: &[u8]) -> Vec<String>
pub fn feed(&mut self, bytes: &[u8]) -> Vec<String>
Feed raw output bytes, returning the rows evicted by scrolling.
Bytes are parsed as a VT stream and applied to the grid; multi-byte and split UTF-8 sequences are reassembled across calls by the parser. Evicted rows are returned oldest first, already styled, so the caller can retain a bounded tail in order (for a failure replay) or drop them.