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/Core.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/Core.zig')
| -rw-r--r-- | src/Core.zig | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/Core.zig b/src/Core.zig index 55848aa9..62f54416 100644 --- a/src/Core.zig +++ b/src/Core.zig @@ -389,8 +389,8 @@ scratch: std.heap.ArenaAllocator, /// that still own their loop pass their own arena to `render` instead. frame_arena: std.heap.ArenaAllocator, /// the terminal motion surface, memoized against the pane it was built -/// for — see panes.terminal.RowsCache for the lifetime rule -shell_rows: pardes.panes.terminal.RowsCache = .{}, +/// for — see edit.RowsCache for the lifetime rule +shell_rows: pardes.edit.RowsCache = .{}, /// Finished command panes' output, and whether it is a diff /// (File.DiffOutput). diff_output: pardes.panes.File.DiffOutput = .{}, @@ -2741,7 +2741,7 @@ test "a command of several lines keeps its tag one row, and its echo does not st _ = exec.execute(p, 1, two); while (p.nextEffect()) |_| {} _ = try p.render(frame.allocator()); - const body = try pardes.panes.terminal.screenTextAlloc(pane, gpa); + const body = try pardes.Term.scrollback(pane.terminal, gpa); defer gpa.free(body); try std.testing.expect(std.mem.indexOf(u8, body, "% def greet(name):\n return name") != null); } @@ -3080,7 +3080,7 @@ test "a command pane shows how its command ended, and the next command there run const pane = p.panes[dst].?; // Its first command is echoed as every later one is. { - const first = try pardes.panes.terminal.screenTextAlloc(pane, gpa); + const first = try pardes.Term.scrollback(pane.terminal, gpa); defer gpa.free(first); try std.testing.expect(std.mem.startsWith(u8, first, "% make -j8")); } @@ -3120,7 +3120,7 @@ test "a command pane shows how its command ended, and the next command there run respawned = true; }; try std.testing.expect(respawned); - const body = try pardes.panes.terminal.screenTextAlloc(pane, gpa); + const body = try pardes.Term.scrollback(pane.terminal, gpa); defer gpa.free(body); const said = std.mem.indexOf(u8, body, "compiled") orelse return error.OutputLost; const ended = std.mem.indexOf(u8, body, "exit 2") orelse return error.ExitLost; @@ -3932,14 +3932,14 @@ test "leaving tty hides the prompt and keeps the command typed at it" { const rowOf = struct { fn at(pp: *Pardes, pane: *Pane, needle: []const u8) ?[]const u8 { - const rows = pardes.panes.terminal.shellRows(pp, pane) catch return null; + const rows = pardes.edit.shellRows(pp, pane) catch return null; for (rows) |r| if (std.mem.indexOf(u8, r, needle) != null) return r; return null; } }.at; const bodyRowOf = struct { fn at(pp: *Pardes, pane: *Pane, needle: []const u8) ?[]const u8 { - const body = pardes.panes.terminal.bodyText(pp.scratch.allocator(), pane) catch return null; + const body = @import("body_layer.zig").bodyText(pp.scratch.allocator(), pane) catch return null; var it = std.mem.splitScalar(u8, body, '\n'); while (it.next()) |r| if (std.mem.indexOf(u8, r, needle) != null) return r; return null; @@ -3994,7 +3994,7 @@ test "entering tty walks the shell cursor to the column clicked past the prompt" p.shell_rows.stale = true; // The command shows LEFT-HUGGED, so its column 3 is the '3'... - const rows = try pardes.panes.terminal.shellRows(p, sp); + const rows = try pardes.edit.shellRows(p, sp); var row: i32 = 0; const at = for (rows, 0..) |r, i| { if (std.mem.indexOf(u8, r, "0123456789") != null) break i; |
