pub struct Screen { /* private fields */ }Expand description
The diff renderer - maintains previous frame and emits minimal ANSI updates.
Implementations§
Source§impl Screen
impl Screen
pub fn new() -> Self
Sourcepub fn prev_viewport_top(&self) -> usize
pub fn prev_viewport_top(&self) -> usize
Viewport top position (first visible line in terminal)
Sourcepub fn hardware_cursor_row(&self) -> usize
pub fn hardware_cursor_row(&self) -> usize
The row where the hardware cursor physically sits after the last render. Used by TUI to position the cursor to the marker position via relative movements (matching pi’s approach).
Sourcepub fn set_hardware_cursor_row(&mut self, row: usize)
pub fn set_hardware_cursor_row(&mut self, row: usize)
Update the tracked hardware cursor row after TUI repositions the cursor (matching pi’s hardwareCursorRow = targetRow in positionHardwareCursor).
pub fn prev_width(&self) -> usize
pub fn prev_height(&self) -> usize
pub fn full_redraw_count(&self) -> usize
Sourcepub fn total_lines(&self) -> usize
pub fn total_lines(&self) -> usize
Total number of lines in the last rendered frame.
Sourcepub fn finalize(&mut self, writer: &mut dyn Write) -> Result<()>
pub fn finalize(&mut self, writer: &mut dyn Write) -> Result<()>
Move cursor to one line past all rendered content (for clean program exit).
Writes the ANSI cursor-positioning sequences and \r\n so that subsequent
shell output appears on a fresh line after all TUI content.
pub fn set_clear_on_shrink(&mut self, enabled: bool)
Sourcepub fn set_use_sync_output(&mut self, enabled: bool)
pub fn set_use_sync_output(&mut self, enabled: bool)
Enable or disable synchronized output markers (\x1b[?2026h / \x1b[?2026l). Enabled by default (matching pi’s always-on approach).
Sourcepub fn render(
&mut self,
new_lines: Vec<String>,
width: u16,
height: u16,
writer: &mut dyn Write,
) -> Result<Option<(usize, usize)>>
pub fn render( &mut self, new_lines: Vec<String>, width: u16, height: u16, writer: &mut dyn Write, ) -> Result<Option<(usize, usize)>>
Render new lines to the terminal using differential updates.
writer should be the terminal’s stdout (in raw mode).
width and height are the current terminal dimensions.
Lines may contain cursor markers (CURSOR_MARKER) which are extracted
and used for cursor tracking. Returns the cursor (row, col) position
if a marker was found, or None.