From 26929e67111e843db4ad27abb4f1341cf396158c Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 17 Nov 2026 00:38:41 -0300 Subject: 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 --- src/ninep/screen.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ninep/screen.zig') diff --git a/src/ninep/screen.zig b/src/ninep/screen.zig index 634ef640..1bfd9b63 100644 --- a/src/ninep/screen.zig +++ b/src/ninep/screen.zig @@ -64,7 +64,7 @@ pub fn readSnapshot(p: *Pardes, req: Req, pane: ?*Pane) Reply { const snapshot = &(tree.openOf(p, req) orelse return Reply.fail(req.tag, E.INVAL)).what.snapshot; if (snapshot.* == null) { const terminal = pane orelse return Reply.fail(req.tag, E.INVAL); - snapshot.* = panes.terminal.screenTextAlloc(terminal, p.gpa) catch return Reply.fail(req.tag, E.NOMEM); + snapshot.* = pardes.Term.scrollback(terminal.terminal, p.gpa) catch return Reply.fail(req.tag, E.NOMEM); } return tree.window(p, req, snapshot.*.?); } @@ -126,7 +126,7 @@ test "terminal body handles keep one history snapshot across fragmented reads" { const node = Node.of(serialOf(p), .body); p.update(.{ .output = .{ .pane = 0, .bytes = "old caf\xc3\xa9\r\nold tail" } }); while (p.nextEffect()) |_| {} - const original = try panes.terminal.screenTextAlloc(p.panes[0].?, gpa); + const original = try pardes.Term.scrollback(p.panes[0].?.terminal, gpa); defer gpa.free(original); const opened = call(p, .{ .tag = 1, .op = .open, .node = node }); try testing.expectEqual(Status.ok, opened.reply.status); -- cgit v1.3