diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/kitty.zig | 7 | ||||
| -rw-r--r-- | test/panes.zig | 14 | ||||
| -rw-r--r-- | test/perf.zig | 2 |
3 files changed, 11 insertions, 12 deletions
diff --git a/test/kitty.zig b/test/kitty.zig index 4341677e..760d22be 100644 --- a/test/kitty.zig +++ b/test/kitty.zig @@ -19,7 +19,6 @@ const std = @import("std"); const pardes = @import("pardes"); const Pardes = pardes.Pardes; const config = pardes.config; -const terminal = pardes.panes.terminal; const gpa = std.testing.allocator; @@ -309,7 +308,7 @@ test "kitty: text around an APC prints, in the same read and split across reads" var r = try Rig.init(1); defer r.deinit(); r.feedSplit(0, "before" ++ apc("a=t,i=3,f=24,s=4,v=2,q=2", rgb_b64) ++ "after", step); - const text = try terminal.screenTextAlloc(r.pane(0), r.frame.allocator()); + const text = try pardes.Term.scrollback(r.pane(0).terminal, r.frame.allocator()); try std.testing.expect(std.mem.indexOf(u8, text, "beforeafter") != null); try std.testing.expect(r.hasImage(0, 3)); } @@ -643,7 +642,7 @@ test "kitty: an image follows its text when the shell scrolls, resizes and reflo // A narrower pane reflows the text; the image stays on its row. const pane = r.pane(0); pane.resizeGrid(40, pane.rows); - const text = try terminal.screenTextAlloc(pane, r.frame.allocator()); + const text = try pardes.Term.scrollback(pane.terminal, r.frame.allocator()); var row: usize = 0; var lines = std.mem.splitScalar(u8, text, '\n'); while (lines.next()) |line| : (row += 1) if (std.mem.startsWith(u8, line, "marker")) break; @@ -762,7 +761,7 @@ test "kitty: a cancelled (CAN, SUB) APC runs nothing, answers nothing, and the t r.feed(0, "after"); try std.testing.expect(!r.hasImage(0, 60)); try std.testing.expectEqualStrings("", try r.take(0)); - const text = try terminal.screenTextAlloc(r.pane(0), r.frame.allocator()); + const text = try pardes.Term.scrollback(r.pane(0).terminal, r.frame.allocator()); try std.testing.expect(std.mem.indexOf(u8, text, "after") != null); } } 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 }); diff --git a/test/perf.zig b/test/perf.zig index b8514d26..d9341cad 100644 --- a/test/perf.zig +++ b/test/perf.zig @@ -880,7 +880,7 @@ fn measureUndoOutput(core: *pardes.Pardes, counter: *Allocations, arena: *std.he pane.body.cur_row = first + 1; pane.body.cur_col = 1; pane.body.vsel = .{ .active = true, .row = first, .col = 0 }; - try pardes.panes.terminal.pushUndo(core, pane); + try pane.body.remember(core.gpa, pane.ovl); core.gpa.free(pane.ovl.?.text); pane.ovl = null; if (pane.body.ed_undo_len != index + 1) return error.TerminalUndoSnapshotFailed; |
