diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 00:17:45 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | 5354090b6122faf0d18e246a55e8a4ead0955394 (patch) | |
| tree | f27fc08bba1ceded6bf315125090ef0b64405463 /src/Term.zig | |
| parent | c742d19d4bacbd9a91627c4859ca8cb0d11bdba7 (diff) | |
| download | pardes-5354090b6122faf0d18e246a55e8a4ead0955394.tar.gz pardes-5354090b6122faf0d18e246a55e8a4ead0955394.zip | |
Term: output and view through the interface: Term.feed takes one read and the rows the core keeps positions on and gives back a Term.Told (where each went, erased or not, cleared, alive, a pin missed), Term.grid is the plain record of the view and the cursor (total, offset, len, the cursor, whether it shows, the view's row or null while it follows), Term.scroll, Term.follow, Term.viewTo, Term.resize (now or for later) and Term.resizeDeferred move it, Term.cellPixels sizes its cells in pixels and Term.replies hands over what it answered its program; the core's half is the core's: Pane.feedOutput and its row tracking (the edit copy's rows, the cursors and selections, their undo and the pointer's rows, gathered as rows and moved as the feed told, ingestWithPositions's core) and Pane.followOutput, Pane.resizeGrid and Pane.panFor in panes.zig with panes.resizeDeferred, the cursor a program shows read from the grid where the body draws it, tape.viewOnly beside tape.authorityOnly; scrollbar, gridOffset, gridCursor, visibleCursor, viewOf, atBottom and their types go; nothing else changes
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 }; |
