pub struct Term { /* private fields */ }Expand description
A minimal VT100/ECMA-48 terminal emulator over an ansi::Screen.
Implementations§
Source§impl Term
impl Term
Sourcepub fn new(rows: usize, cols: usize) -> Self
pub fn new(rows: usize, cols: usize) -> Self
A blank emulator of rows x cols (both clamped to at least 1), cursor
at the origin, full-height scroll region, default tab stops every 8
columns, autowrap on, cursor visible.
Sourcepub fn feed(&mut self, bytes: &[u8])
pub fn feed(&mut self, bytes: &[u8])
Feed a chunk of child output. Chunks may split at any byte boundary (mid-escape, mid-UTF-8); the internal parser holds partial state across calls, so the final screen is independent of how bytes were chunked.
Sourcepub fn take_dirty(&mut self) -> bool
pub fn take_dirty(&mut self) -> bool
Returns true if any bytes have been fed (or a resize has occurred)
since the last call to take_dirty, and resets the flag. Call once
per frame decision to avoid redundant compositing.
Sourcepub fn screen(&self) -> &Screen
pub fn screen(&self) -> &Screen
The active buffer (alternate while in alt-screen, else primary). Its
cursor is the emulator’s cursor, so a compositor / Screen::diff parks
the terminal cursor correctly.
Sourcepub fn in_sync(&self) -> bool
pub fn in_sync(&self) -> bool
True while the child is inside a synchronized update (DEC mode 2026):
it has emitted ?2026h and not yet the matching ?2026l. During this
window Term::screen returns the last complete frame. Exposed so a
host can also gate its own compositing on it if desired.