Skip to main content

Crate avt

Crate avt 

Source
Expand description

A virtual terminal with composable observers.

Terminal interprets application output, including text and control sequences, and maintains primary and alternate screen buffers. Plain mutations return (); _with variants return an Observer’s output.

Stateful observers should be reused across calls when collecting dirty rows, transcripts, or shell integration events. Feed boundaries do not finish parsing or logical lines.

use avt::observer::DirtyRows;
use avt::Terminal;

let mut terminal = Terminal::new(80, 24)?;
let mut dirty = DirtyRows::new();
let rows = terminal.feed_with(["hello", "\r\nworld"], &mut dirty);
assert_eq!(rows.len(), 24); // First observation requests a full repaint.
assert_eq!(terminal.screen().line(1).unwrap().text().trim_end(), "world");

Parser can also be used independently, with parsed functions passed to Terminal::execute. Construction is fallible and defaults to zero history; Terminal::with_scrollback enables bounded or unlimited primary history. Terminal::dump initializes visible state and pending parsing, omitting retained history and analysis state. See the repository examples for rendering, transcripts, shell tracking, replay, and dependency-based slicing.

Re-exports§

pub use input::AsInput;
pub use input::Input;
pub use input::IntoInputs;
pub use observer::Observation;
pub use observer::Observer;
pub use operation::IntoOperations;
pub use operation::Operation;
pub use parser::Parser;

Modules§

input
Single fragments and flat sequences accepted by terminal feeds.
observer
Synchronous terminal observation and built-in observers.
operation
parser

Structs§

Anchor
An owned handle to a position tracked through editing, scrolling, and reflow. Only the originating terminal can resolve it.
Cell
Cursor
InvalidSize
Rejected terminal dimensions. Both columns and rows must be positive.
Line
Pen
Position
A screen-relative coordinate value at a particular moment. Negative rows address retained scrollback. col may equal the line width, representing the boundary after its last cell.
Rgb
Screen
Borrowed read-only view of a terminal screen, including visible rows and any retained scrollback. Copy; methods take self and return data bound to the underlying buffer lifetime.
Terminal
A virtual terminal with a parser and primary and alternate screen buffers. Primary-screen ED2 preserves the occupied screen prefix in scrollback, subject to normal retention and eviction. The cursor stays in place.

Enums§

Charset
Color
ScreenKind
Identifies the primary or alternate screen.