diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 00:38:41 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | 26929e67111e843db4ad27abb4f1341cf396158c (patch) | |
| tree | 8540497ac35231593742c17fb6df03ec0a16a76f /src/Term.zig | |
| parent | 1d382a3ed42788e82301d0ce2a16ebc35c79046c (diff) | |
| download | pardes-26929e67111e843db4ad27abb4f1341cf396158c.tar.gz pardes-26929e67111e843db4ad27abb4f1341cf396158c.zip | |
Term: text through the interface, the editing of the copy back to the core: Term.scrollback and Term.scrollbackLen are its whole history as plain text (its body, Save), Term.textRows its rows as text with a prompt's own cells cut off (a plain Term.Rows), Term.viewport the rows its view shows, Term.promptPrefix how many bytes of a row are its prompt and Term.markRead says a step read them; the editing of the copy of a terminal's rows is the core's again, in edit.zig beside the text it edits: shellRows and the rows' cache (edit.RowsCache, edit.drawing), terminalLines (the rows with the copy spliced in), and in edit.zig's own flatSurface, editText, setEditText, pushUndo and undoStep the terminal's arms written out where they were dispatched to terminal.zig; the body's walk over the rows and the copy (BodyWalk) is body_layer.zig's, beside the bodyText it makes; screenTextAlloc, screenTextLen, cursorLines, flatSurface, editText, setEditText, pushUndo, undoStep and bodyText leave terminal.zig; nothing else changes
Diffstat (limited to 'src/Term.zig')
| -rw-r--r-- | src/Term.zig | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Term.zig b/src/Term.zig index ba0a2307..160ed01e 100644 --- a/src/Term.zig +++ b/src/Term.zig @@ -166,3 +166,32 @@ pub const CommandOutput = struct { /// it ran, or never marked (a C or D on the alternate screen). whole: bool, }; + +// ---- text ---- + +/// Its whole scrollback as plain text, logical lines (rows it wrapped +/// joined again), ending in a newline: what its body reads and Save +/// writes. The caller's. +pub const scrollback = terminal.scrollback; +/// How long `scrollback` would be, counted without keeping it. +pub const scrollbackLen = terminal.scrollbackLen; +/// Its rows from the top of its history as text, a prompt's own cells cut +/// off (`Rows`). +pub const textRows = terminal.textRows; +/// The rows its view shows as text, prompts cut off or not. +pub const viewport = terminal.viewport; +/// How many bytes of one of its rows, as `viewport` and `textRows` give it +/// uncut, are the prompt it starts with. +pub const promptPrefix = terminal.promptPrefix; +/// A step read its rows: its replicas must hold them for the step's +/// replay. +pub const markRead = terminal.markRead; + +/// A terminal's rows as text: `rows` slices into `text`, which is a prefix +/// of `text_alloc` (a prompt cut off shortens the join), the last row the +/// empty one after the cursor's. +pub const Rows = struct { + text_alloc: []u8, + text: []const u8, + rows: [][]const u8, +}; |
