summaryrefslogtreecommitdiff
path: root/test/panes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 00:38:41 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commit26929e67111e843db4ad27abb4f1341cf396158c (patch)
tree8540497ac35231593742c17fb6df03ec0a16a76f /test/panes.zig
parent1d382a3ed42788e82301d0ce2a16ebc35c79046c (diff)
downloadpardes-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 'test/panes.zig')
-rw-r--r--test/panes.zig14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/panes.zig b/test/panes.zig
index 301568c1..5562105e 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -1016,7 +1016,7 @@ test "terminal output keeps following new rows after scrollback eviction" {
try std.testing.expect(pages.page_size <= pages.limits.max(.bytes));
const sb = pages.scrollbar();
try std.testing.expectEqual(sb.total - pane.rows, sb.offset);
- const full = try panes.terminal.screenTextAlloc(pane, gpa);
+ const full = try pardes.Term.scrollback(pane.terminal, gpa);
defer gpa.free(full);
var last_buf: [16]u8 = undefined;
const last = try std.fmt.bufPrint(&last_buf, "row-{d:0>5}", .{(phase + 1) * 20_000 - 1});
@@ -1080,7 +1080,7 @@ test "terminal edit stays on its surviving row when old scrollback is evicted" {
}
}
try std.testing.expect(removed > 0 and removed < original_row);
- const full = try panes.terminal.screenTextAlloc(pane, gpa);
+ const full = try pardes.Term.scrollback(pane.terminal, gpa);
defer gpa.free(full);
const row = original_row - @as(i32, @intCast(removed));
try std.testing.expectEqualStrings(last, modal.lineSlice(full, @intCast(row)));
@@ -1111,7 +1111,7 @@ test "terminal edits and undo survive partial history clearing and whole-screen
pane.body.cur_col = 4;
pane.body.cur_pinned = true;
pane.body.vsel = .{ .active = true, .row = row, .col = 1 };
- try panes.terminal.pushUndo(p, pane);
+ try pane.body.remember(p.gpa, pane.ovl);
const overlay = pane.ovl.?;
pane.body.ed_redo[0] = .{
.ovl = .{ .row = overlay.row, .rows = overlay.rows, .text = try gpa.dupe(u8, overlay.text) },
@@ -1153,7 +1153,7 @@ test "terminal edits and undo survive partial history clearing and whole-screen
try std.testing.expectEqualStrings("edit one\nedit two", snapshot.ovl.?.text);
}
try std.testing.expectEqual(@as(usize, 2), pane.terminal.?.vt.screens.active.pages.countTrackedPins());
- try panes.terminal.undoStep(p, pane, true);
+ try pardes.edit.undoStep(p, &pane.body, true);
try std.testing.expectEqualStrings("edit one\nedit two", pane.ovl.?.text);
try std.testing.expectEqual(expected, pane.ovl.?.row);
}
@@ -1170,7 +1170,7 @@ test "terminal lower scroll regions do not move edits above them" {
pane.ovl = .{ .row = 1, .rows = 1, .text = try gpa.dupe(u8, "unsent") };
pane.body.cur_row = 1;
pane.body.cur_pinned = true;
- try panes.terminal.pushUndo(p, pane);
+ try pane.body.remember(p.gpa, pane.ovl);
const total = pardes.Term.grid(pane.terminal).total;
var setup: [64]u8 = undefined;
const bytes = try std.fmt.bufPrint(&setup, "\x1b[4;{d}r\x1b[{d};1H", .{ pane.rows, pane.rows });
@@ -1180,7 +1180,7 @@ test "terminal lower scroll regions do not move edits above them" {
try std.testing.expectEqual(@as(i32, 1), pane.ovl.?.row);
try std.testing.expectEqual(@as(i32, 1), pane.body.cur_row);
try std.testing.expectEqual(@as(i32, 1), pane.body.ed_undo[0].ovl.?.row);
- const full = try panes.terminal.screenTextAlloc(pane, gpa);
+ const full = try pardes.Term.scrollback(pane.terminal, gpa);
defer gpa.free(full);
try std.testing.expect(std.mem.startsWith(u8, full, "top\nsecond\nthird\n"));
}
@@ -1210,7 +1210,7 @@ test "terminal eviction and lower-region scrolling in one read preserve a surviv
pane.ovl = .{ .row = old_row, .rows = 1, .text = try gpa.dupe(u8, "kept edit") };
pane.body.cur_row = old_row;
pane.body.cur_pinned = true;
- try panes.terminal.pushUndo(p, pane);
+ try pane.body.remember(p.gpa, pane.ovl);
const old_total = pages.total_rows;
var buf: [128]u8 = undefined;
const bytes = try std.fmt.bufPrint(&buf, "new\r\n\x1b[4;{d}r\x1b[{d};1Hregion\r\n", .{ pane.rows, pane.rows });