diff options
Diffstat (limited to 'src/Term.zig')
| -rw-r--r-- | src/Term.zig | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/Term.zig b/src/Term.zig index 36315df4..41452757 100644 --- a/src/Term.zig +++ b/src/Term.zig @@ -29,3 +29,51 @@ pub const revive = terminal.revive; /// stopped with the host. pub const start = terminal.TerminalImages.start; pub const stop = terminal.TerminalImages.stop; + +// ---- output and view ---- + +/// One read of its program's output (`Told` says where the tracked rows +/// went). +pub const feed = terminal.feed; +/// Where the view and the cursor are (`Grid`). +pub const grid = terminal.grid; +/// Its view to a row of its history, or onto its output (null). +pub const viewTo = terminal.viewTo; +/// Its view moved by a number of rows (negative scrolls back). +pub const scroll = terminal.scroll; +/// Its view back onto its output. +pub const follow = terminal.follow; +/// Its grid reflowed, now or when `resizeDeferred` makes it. +pub const resize = terminal.resize; +pub const resizeDeferred = terminal.resizeDeferred; +/// Its cells' size in pixels (kitty graphics, CSI 14/16 t). +pub const cellPixels = terminal.cellPixels; +/// What it answered its program since the last call, to be written to its +/// pty. +pub const replies = terminal.replies; + +/// Where the view and the cursor are, in rows counted from the top of the +/// history: `total` rows, the view's top at `offset`, `len` of them shown. +/// All zero without a terminal. +pub const Grid = struct { + total: usize = 0, + offset: usize = 0, + len: usize = 0, + /// The cursor, in cells of the active area (the history's last `len` + /// rows). + cursor_x: u16 = 0, + cursor_y: u16 = 0, + /// The program shows the cursor (DECTCEM). + cursor_visible: bool = false, + /// The view's top row while it is scrolled to one, null while it + /// follows the output. + view: ?usize = null, +}; + +/// What a `feed` told the rows the core keeps positions on: each tracked +/// row where it is after the read, whether the program erased it, whether +/// it cleared the screen, whether the pages the rows were on lived through +/// it (a reset can take them) and whether a row could not be followed (no +/// memory for its pin). Taped: a screen-state replica, which feeds +/// nothing, is told its authority's. +pub const Told = struct { rows: []const i32, erased: []const bool, cleared: bool, alive: bool, failed: bool }; |
