Expand description
Host-agnostic VT/ANSI terminal engine.
frankenterm-core is the platform-independent terminal model at the heart of
FrankenTerm. It owns grid state, VT/ANSI parsing, cursor positioning, and
scrollback — all without any host I/O dependencies.
§Primary responsibilities
- Grid: 2D cell matrix representing the visible terminal viewport.
- Cell: character content + SGR attributes (colors, bold, italic, etc.).
- Parser: VT/ANSI state machine (Paul Flo Williams model, 12 states).
- Cursor: position, visibility, and origin/autowrap mode tracking.
- Modes: DEC private modes and ANSI standard modes.
- Patch: minimal diff between two grid snapshots for efficient updates.
- Scrollback: ring buffer for lines scrolled off the top of the viewport.
§Design principles
- No I/O: all types are pure data + logic; the host adapter supplies bytes.
- Deterministic: identical byte sequences always produce identical state.
#![forbid(unsafe_code)]: safety enforced at compile time.
Re-exports§
pub use cell::Cell;pub use cell::CellFlags;pub use cell::Color;pub use cell::HyperlinkId;pub use cell::HyperlinkRegistry;pub use cell::MAX_COMBINING;pub use cell::SgrAttrs;pub use cell::SgrFlags;pub use cursor::Cursor;pub use cursor::SavedCursor;pub use cursor::translate_charset;pub use export::AnsiExportOptions;pub use export::ColorDepth;pub use export::ExportContext;pub use export::ExportRange;pub use export::ExportRow;pub use export::HtmlExportOptions;pub use export::LineEnding;pub use export::TextExportOptions;pub use export::export_ansi;pub use export::export_html;pub use export::export_text;pub use flow_control::ActionLoss;pub use flow_control::BackpressureAction;pub use flow_control::DecisionReason;pub use flow_control::FlowControlConfig;pub use flow_control::FlowControlDecision;pub use flow_control::FlowControlPolicy;pub use flow_control::FlowControlSnapshot;pub use flow_control::InputEventClass;pub use flow_control::LatencyWindowMs;pub use flow_control::LossWeights;pub use flow_control::QueueDepthBytes;pub use flow_control::RateWindowBps;pub use flow_control::jain_fairness_index;pub use grid::Grid;pub use modes::AnsiModes;pub use modes::DecModes;pub use modes::Modes;pub use parser::Action;pub use parser::CsiParams;pub use parser::Parser;pub use patch::CellUpdate;pub use patch::ChangeRun;pub use patch::DirtySpan;pub use patch::DirtyTracker;pub use patch::GridDiff;pub use patch::Patch;pub use reply::ReplyContext;pub use reply::ReplyEngine;pub use reply::TerminalQuery;pub use reply::parse_terminal_query;pub use reply::reply_for_query;pub use reply::reply_for_query_bytes;pub use scrollback::Scrollback;pub use scrollback::ScrollbackLine;pub use scrollback::ScrollbackWindow;pub use selection::BufferPos;pub use selection::CopyOptions;pub use selection::Selection;pub use selection_state::AutoScrollHint;pub use selection_state::GestureConfig;pub use selection_state::SelectionDirection;pub use selection_state::SelectionGestureController;pub use selection_state::SelectionGranularity;pub use selection_state::SelectionPhase;pub use selection_state::SelectionShape;pub use selection_state::SelectionState;pub use terminal_engine::DEFAULT_SCROLLBACK_CAPACITY;pub use terminal_engine::TerminalEngine;pub use terminal_engine::TerminalEngineConfig;pub use width_policy::WidthPolicy;
Modules§
- cell
- Terminal cell: the fundamental unit of the grid.
- cursor
- Terminal cursor: position, visibility, movement, and saved state.
- export
- Export adapters for converting terminal grid state to external formats.
- flow_
control - Deterministic flow-control and backpressure policy for FrankenTerm remote I/O.
- grid
- Terminal grid: 2D cell matrix representing the visible viewport.
- modes
- Terminal modes (ANSI + DEC private).
- parser
- VT/ANSI parser.
- patch
- Incremental patch API: dirty tracking, grid diff, and change runs.
- reply
- Terminal query/reply engine for VT/ANSI request sequences.
- scrollback
- Scrollback buffer: lines that have scrolled off the visible viewport.
- selection
- Selection model + copy extraction for terminal grid + scrollback.
- selection_
state - Selection state machine for interactive selection lifecycle.
- terminal_
engine - Canonical terminal engine that composes parser + state + reply generation.
- width_
policy - Configurable Unicode character width policy.