Skip to main content

Terminal

Struct Terminal 

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

A pure-Rust VT terminal emulator with incremental byte processing.

Feed bytes via write, then query the screen state via accessors like plain_text or cell.

Implementations§

Source§

impl Terminal

Source

pub fn new(cols: usize, rows: usize) -> Self

Create a new terminal with the given dimensions.

Source

pub fn set_max_scrollback(&mut self, max: usize)

Set the maximum number of scrollback lines.

Source

pub fn write(&mut self, bytes: &[u8])

Process a byte stream incrementally.

Source

pub fn take_output(&mut self) -> Vec<u8>

Take accumulated response bytes (DSR replies, DA responses).

Source

pub fn take_clipboard(&mut self) -> Vec<String>

Take accumulated clipboard writes.

Source

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

Resize the terminal.

Source

pub fn cols(&self) -> usize

Source

pub fn rows(&self) -> usize

Source

pub fn active_screen(&self) -> ScreenKind

Source

pub fn cursor(&self) -> Cursor

Source

pub fn current_style(&self) -> &Style

Source

pub fn bell_count(&self) -> usize

Source

pub fn title(&self) -> Option<&str>

Source

pub fn cell(&self, col: usize, row: usize) -> Option<&Cell>

Get the cell at the given position.

Source

pub fn grid(&self) -> &[Cell]

Get the full grid as a flat slice.

Source

pub fn scrollback_len(&self) -> usize

Number of scrollback lines available.

Source

pub fn scrollback_row(&self, index: usize) -> Option<String>

Get a scrollback row by index (0 = oldest), trimmed of trailing blanks.

Source

pub fn plain_text(&self) -> String

Extract plain text from the visible screen.

Source

pub fn screen_dump(&self) -> String

Extract plain text including scrollback.

Source

pub fn wraparound(&self) -> bool

Source

pub fn cursor_visible(&self) -> bool

Source

pub fn cursor_shape(&self) -> CursorShape

Source

pub fn application_cursor_keys(&self) -> bool

Source

pub fn bracketed_paste(&self) -> bool

Source

pub fn focus_reporting(&self) -> bool

Source

pub fn mouse_tracking(&self) -> Option<MouseTracking>

Source

pub fn sgr_mouse(&self) -> bool

Source

pub fn scroll_region(&self) -> (usize, usize)

Auto Trait Implementations§

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.