diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-22 20:21:32 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-22 20:21:32 -0300 |
| commit | 3f250d0f963f375d699f11ffc02b07f2e2cbbbee (patch) | |
| tree | 4e5a1f577fd3dd247f3643d979868347524ce703 /abi/term.zig | |
| parent | 34e2d82a322bd3767a8ec62b3a4c0894399e8c04 (diff) | |
| parent | c607dc14502a6956bdfa3575bc7363514a7abeb4 (diff) | |
| download | pardes-3f250d0f963f375d699f11ffc02b07f2e2cbbbee.tar.gz pardes-3f250d0f963f375d699f11ffc02b07f2e2cbbbee.zip | |
integration (a base for the terminals' next round, not yet the gathered line): the viewport in the view and the patches in the semantics hash on merge58 with the terminal put back: pardes-raw-tty (`muwnrqro`, on pardes-merge58: a TERM that reaches a session while it leaves its terminal no longer leaves it raw: `Killed.disarm` puts the cooked modes back itself, `leave` calls it last) and pardes-term-join-10's two changes (`xktusoyq` on `qtxssxyk`, on pardes-term-join-9: where a view stands in a terminal's history is the view's (`Pane.scrolled_to`), carried once a confirmed write that moves rows, the wire at 31; build/patches hashed into a replica's semantics); no conflict; core-test 917/1077 (160 skipped), shell-test 1119/1122, pane-test 182/183, term-test 16/16; NOT gated whole: the viewport's gate had one perf count over its budget ("terminal on all" +0.235%), which the next round brings down before this is the gathered line (2026-11-22)
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'abi/term.zig')
| -rw-r--r-- | abi/term.zig | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/abi/term.zig b/abi/term.zig index d6c48f96..31f155e8 100644 --- a/abi/term.zig +++ b/abi/term.zig @@ -13,22 +13,19 @@ const CellStyle = plain.CellStyle; /// A terminal: its emulator, its parse and what is kept beside it. pub const State = opaque {}; -/// 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. +/// How much history there is and where the cursor is, in rows counted from +/// the top of the history: `total` rows, the last `len` of them the active +/// area (the program's screen). All zero without a terminal. Where a view +/// of it stands is the view's, not the terminal's (a `place`: the row its +/// top shows, or null on the output; core/panes.zig `scrolled_to`). 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). + /// The cursor, in cells of the active area. 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, /// Its grid's width. cols: u16 = 0, }; @@ -211,6 +208,8 @@ pub const PaintedRow = struct { /// `rows_of[v]` is the body row its view's row `v` shows on, null for one /// not shown. pub const ImagesAt = struct { + /// The view's place (`Grid`): the rows it shows. + place: ?usize, pane: u8, serial: u32, tx: u16, @@ -239,8 +238,6 @@ pub const EchoCell = struct { cp: u21, input: bool, style: u32 }; pub const Parts = struct { reply: []const u8 = "", reply_dropped: u32 = 0, - /// The view's top row, counted from the top of the history. - view: usize = 0, phase: Prompt.Phase = .none, started: u32 = 0, prompts: u32 = 0, @@ -293,8 +290,8 @@ pub const Ops = struct { gpa: *const fn (s: *const State) std.mem.Allocator, // ---- the dump and the digest (`Term.State`'s walk hooks) ---- - /// Its screen into the replay digest (`view`: where its view is too). - digest: *const fn (s: *const State, h: *std.hash.Wyhash, view: bool) void, + /// Its screen into the replay digest. + digest: *const fn (s: *const State, h: *std.hash.Wyhash) void, /// What the dump keeps of it beside its emulator. parts: *const fn (s: *const State) Parts, /// Its emulator as the dump keeps it (ghostty's snapshot); `slim`: its @@ -309,16 +306,19 @@ pub const Ops = struct { /// now on (the core's: a recorded answer). media: *const fn (read: Media) void, - // ---- output and view ---- + // ---- output and size ---- /// One read of its program's output (`Told` says where the tracked - /// rows went). - feed: *const fn (s: *State, bytes: []const u8, track: []const i32, rows: []i32, erased: []bool) Told, + /// rows went), every view's `places` carried through it (`resize`). + feed: *const fn (s: *State, bytes: []const u8, track: []const i32, rows: []i32, erased: []bool, places: []?usize) Told, // A null handle: what a pane without a terminal is told (all zero). grid: *const fn (s: ?*const State) Grid, - viewTo: *const fn (s: *State, at: ?usize) void, - scroll: *const fn (s: *State, delta: i32) void, - follow: *const fn (s: *State) void, - resize: *const fn (s: *State, cols: u16, rows: u16) void, + /// Its grid reflowed, every view's place (`Grid`) carried through it as + /// ghostty carries a view of its own: on its row while rows come below, + /// up by the rows the history drops above it, at the history's top when + /// its own row goes, on the output once it falls into the active area + /// or the screen is reset. A function of the bytes and sizes it was + /// given: the same places on every side. + resize: *const fn (s: *State, cols: u16, rows: u16, places: []?usize) void, cellPixels: *const fn (s: *State, w: u32, h: u32) void, replies: *const fn (s: *State) []const u8, @@ -328,6 +328,8 @@ pub const Ops = struct { wheel: *const fn (s: *State, last: *?Parts.Coordinate, buf: *[64]u8, turn: MouseButton, col: u16, row: u16, mods: MouseMods) ?[]const u8, paste: *const fn (s: ?*const State, text: []u8) [3][]const u8, modes: *const fn (s: ?*const State) Modes, + /// The cursor keys a click at its row `row` (from the top of its + /// history), column `col` of the text shown types at the prompt. promptMoves: *const fn (s: *State, row: i32, col: i32) ?Moves, // ---- prompt and commands ---- @@ -339,7 +341,8 @@ pub const Ops = struct { scrollback: *const fn (s: ?*State, gpa: std.mem.Allocator) error{ OutOfMemory, WriteFailed }![]const u8, scrollbackLen: *const fn (s: ?*State) usize, textRows: *const fn (s: *State, alloc: std.mem.Allocator, scratch: std.mem.Allocator) TextError!Rows, - viewport: *const fn (s: *State, arena: std.mem.Allocator, cut: bool) TextError![]const []const u8, + /// The rows a view at `place` (`Grid`) shows, as text. + viewport: *const fn (s: *State, arena: std.mem.Allocator, cut: bool, place: ?usize) TextError![]const []const u8, /// Its rows `first` and the `count` after it (from the top of its /// history) as text, a prompt's own cells cut off: `arena`'s. editRows: *const fn (s: *State, arena: std.mem.Allocator, first: usize, count: usize) (TextError || error{ NoRow })![]const []const u8, @@ -358,10 +361,11 @@ pub const Ops = struct { spanColor: *const fn (f: *Filter, color: Color, is_bg: bool) Color, // ---- draw ---- - /// Its view's rows, `rows.len` of them, `cols` cells each, into - /// `cells`: each cell's style in the theme's colours (through the - /// filter when `filtered`), its bytes and width. - paint: *const fn (s: *State, ink: *const Ink, palette: *FilterPalette, filtered: bool, first: u16, cols: u16, cells: []Painted, rows: []PaintedRow) void, + /// The rows a view at `place` (`Grid`) shows from its row `first`, + /// `rows.len` of them, `cols` cells each, into `cells`: each cell's + /// style in the theme's colours (through the filter when `filtered`), + /// its bytes and width. + paint: *const fn (s: *State, ink: *const Ink, palette: *FilterPalette, filtered: bool, place: ?usize, first: u16, cols: u16, cells: []Painted, rows: []PaintedRow) void, /// Its kitty images over the body's rows, appended to `out` (`gpa`'s; /// what it keeps to draw them is its own allocator's), and their /// placeholder cells blanked in `frame` (`frame_cols` wide). @@ -380,7 +384,7 @@ pub const Ops = struct { /// file, with its rule: a new one fails its test until it is listed. pub const replicated = [_][]const u8{ "open", "close", "revive", "digest", "parts", "snapshot", "load", "reload", - "media", "feed", "grid", "viewTo", "scroll", "follow", "resize", "replies", + "media", "feed", "grid", "resize", "replies", "key", "mouse", "wheel", "paste", "modes", "promptMoves", "prompt", "commandOutput", "endOutputHere", "scrollback", "scrollbackLen", "textRows", "viewport", "editRows", "promptCut", "page", "filter", "spanColor", "hasImages", |
