Skip to main content

Term

Struct Term 

Source
pub struct Term { /* private fields */ }
Expand description

A minimal VT100/ECMA-48 terminal emulator over an ansi::Screen.

Implementations§

Source§

impl Term

Source

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.

Source

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.

Source

pub fn screen(&self) -> &Screen

The active buffer (alternate while in alt-screen, else primary), with its public cursor field synced to the emulator’s position so a compositor / Screen::diff parks the cursor correctly.

Source

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.

Source

pub fn resize(&mut self, rows: usize, cols: usize)

Resize to rows x cols (clamped to at least 1). For 0.1 this rebuilds fresh buffers of the new size (the caller repaints); the cursor and scroll region are clamped, tab stops rebuilt, and pending wrap cleared.

Auto Trait Implementations§

§

impl Freeze for Term

§

impl RefUnwindSafe for Term

§

impl Send for Term

§

impl Sync for Term

§

impl Unpin for Term

§

impl UnsafeUnpin for Term

§

impl UnwindSafe for Term

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.