Skip to main content

Module reader

Module reader 

Source
Expand description

Reader task — drains the master PTY’s read side into the published TerminalSnapshot cell.

T2 substrate swap (2026-05-25): replaced the homegrown TerminalGrid placeholder with alacritty_terminal::Term + vte::ansi::Processor. Lattice now inherits a full VT/xterm parser (SGR colors / alt-screen / DECCKM / cursor-visibility / OSC titles / scrollback) from the battle-tested alacritty stack — same engine alacritty, zed, and neovide use.

The renderer-facing contract (writes to Arc<ArcSwap<TerminalSnapshot>>) is unchanged. The cells we publish now carry real TerminalColor::Named / Indexed / Rgb values via [map_cell].

Structs§

GridSearchHit
T3.b (2026-05-25): result of SharedTerm::find_match. Carries the alacritty Line and column of a search hit so the caller can scroll the viewport to the matching row.
SharedTerm
Shared handle to the alacritty Term owned by a spawned terminal. The reader task locks the Mutex to advance bytes from the PTY; the host’s dispatch path locks it to invoke scroll / resize / future-T2.c operations. Contention is minimal — the reader only holds the lock during chunk processing (microseconds per call) and dispatch operations are user-driven (one per keystroke).

Enums§

SearchDir
T3.b: search direction. Mirrors lattice_grammar::SearchDirection without depending on the grammar crate from the substrate.
TerminalScrollKind
T3 (2026-05-25): how the caller asks the terminal to reposition the viewport over its scrollback. Mapped 1:1 to alacritty’s Scroll enum at the dispatch site so the public API doesn’t leak alacritty types.

Functions§

spawn_reader
Spawn the reader task on a detached OS thread. Returns the SharedTerm handle the caller stores alongside the snapshot so dispatch-time operations (scroll, resize) can reach into the alacritty Term.