summaryrefslogtreecommitdiff
path: root/test/panes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 20:56:14 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commit04b047fb366ea2c595708fb62467f690fce4b9ec (patch)
treeb2b765cbca96bcfd1785a39f60f0e0398a6aabb2 /test/panes.zig
parent9554cc4c544632b01f740f895fd6db9f9952c02e (diff)
downloadpardes-04b047fb366ea2c595708fb62467f690fce4b9ec.tar.gz
pardes-04b047fb366ea2c595708fb62467f690fce4b9ec.zip
Terminal.zig is terminal.zig: a file of functions and no fields takes a namespace's lowercase name
The last of the deferred renames, now that the tty and theme agents have landed: panes.terminal at its importers, the alias lines in Text.zig and File.zig and panes.zig's own uses following. dump.zig's Terminal struct, a dump record, is not this. The served sources list and docs/design.typ name the new file. test/perf.zig's references change, so the three perf baselines take its new harness id with their numbers as recorded. No behaviour changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/panes.zig')
-rw-r--r--test/panes.zig60
1 files changed, 30 insertions, 30 deletions
diff --git a/test/panes.zig b/test/panes.zig
index 3b2bea0a..f7ca9fc5 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -864,7 +864,7 @@ const TtySelectionTests = struct {
}
test "tty selection yields to a new modal cursor selection" {
- if (comptime !panes.Terminal.enabled) return error.SkipZigTest;
+ if (comptime !panes.terminal.enabled) return error.SkipZigTest;
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 12 });
defer p.deinit();
p.presentation.enabled = false;
@@ -889,7 +889,7 @@ const TtySelectionTests = struct {
}
test "tty selection preserves its exact stream through yank clipboard and mode changes" {
- if (comptime !panes.Terminal.enabled) return error.SkipZigTest;
+ if (comptime !panes.terminal.enabled) return error.SkipZigTest;
for ([_]bool{ false, true }) |prompt| {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 12 });
defer p.deinit();
@@ -949,7 +949,7 @@ const TtySelectionTests = struct {
}
test "tty selection pastes across panes once with existing bracket and mouse protocols" {
- if (comptime !panes.Terminal.enabled) return error.SkipZigTest;
+ if (comptime !panes.terminal.enabled) return error.SkipZigTest;
for ([_]bool{ false, true }) |bracketed| {
for ([_]bool{ false, true }) |reports_mouse| {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 24 });
@@ -1028,14 +1028,14 @@ const TtySelectionTests = struct {
// than the text goes and reads the desktop clipboard on its own account,
// and a coding agent reading it is looking for an image, not for words.
test "raw tty paste chords type at the program instead of reaching it as keys" {
- if (comptime !panes.Terminal.enabled) return error.SkipZigTest;
+ if (comptime !panes.terminal.enabled) return error.SkipZigTest;
for ([_]bool{ false, true }) |bracketed| {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 12 });
defer p.deinit();
const pane = p.panes[0].?;
try std.testing.expectEqual(panes.Text.Mode.tty, pane.body.mode);
if (bracketed) p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b[?2004h" } });
- try std.testing.expectEqual(bracketed, panes.Terminal.bracketedPaste(pane));
+ try std.testing.expectEqual(bracketed, panes.terminal.bracketedPaste(pane));
p.registers.put(p.gpa, '"', "one\ntwo", 0, 1, true); // what a `y` anywhere left behind
var buf: [256]u8 = undefined;
_ = childInput(p, &buf);
@@ -1833,7 +1833,7 @@ test "terminal overlay recoloring never materializes unrelated history" {
_ = try p.render(frame.allocator());
try testing.expect(p.shell_rows.pane == null);
- pane.ovl.?.row = panes.Terminal.gridOffset(pane);
+ pane.ovl.?.row = panes.terminal.gridOffset(pane);
p.gpa.free(pane.ovl.?.text);
pane.ovl.?.text = try p.gpa.dupe(u8, "caf\xc3\xa9 \xe7\x95\x8c");
_ = frame.reset(.retain_capacity);
@@ -1847,7 +1847,7 @@ test "terminal overlay recoloring never materializes unrelated history" {
}
test "terminal output keeps following new rows after scrollback eviction" {
- if (comptime !panes.Terminal.enabled) return error.SkipZigTest;
+ if (comptime !panes.terminal.enabled) return error.SkipZigTest;
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 });
defer p.deinit();
@@ -1863,9 +1863,9 @@ test "terminal output keeps following new rows after scrollback eviction" {
for (0..3) |phase| {
if (phase > 0) {
pane.body.mode = .normal;
- panes.Terminal.scrollGrid(pane, -30);
+ panes.terminal.scrollGrid(pane, -30);
try std.testing.expect(pages.scrollbar().offset < pages.scrollbar().total - pane.rows);
- panes.Terminal.enterTty(p, 0);
+ panes.terminal.enterTty(p, 0);
}
for (phase * 20_000..(phase + 1) * 20_000) |n| {
var buf: [64]u8 = undefined;
@@ -1878,7 +1878,7 @@ test "terminal output keeps following new rows after scrollback eviction" {
try std.testing.expect(pages.page_size <= pages.maxSize());
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 panes.terminal.screenTextAlloc(pane, 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});
@@ -1908,7 +1908,7 @@ test "terminal output keeps following new rows after scrollback eviction" {
}
test "terminal edit stays on its surviving row when old scrollback is evicted" {
- if (comptime !panes.Terminal.enabled) return error.SkipZigTest;
+ if (comptime !panes.terminal.enabled) return error.SkipZigTest;
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 });
defer p.deinit();
@@ -1946,7 +1946,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 panes.terminal.screenTextAlloc(pane, gpa);
defer gpa.free(full);
const row = original_row - @as(i32, @intCast(removed));
try std.testing.expectEqualStrings(last, modal.lineSlice(full, @intCast(row)));
@@ -1956,7 +1956,7 @@ test "terminal edit stays on its surviving row when old scrollback is evicted" {
}
test "terminal edits and undo survive partial history clearing and whole-screen loss" {
- if (comptime !panes.Terminal.enabled) return error.SkipZigTest;
+ if (comptime !panes.terminal.enabled) return error.SkipZigTest;
const gpa = std.testing.allocator;
const Action = enum { clear_history, partial_clear_history, reset_primary, reset_alternate, evict_all, hidden_undo };
for (std.enums.values(Action)) |action| {
@@ -1978,7 +1978,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 };
- panes.Terminal.pushUndo(p, pane);
+ panes.terminal.pushUndo(p, pane);
const overlay = pane.ovl.?;
pane.body.ed_redo[0] = .{
.ovl = .{ .row = overlay.row, .rows = overlay.rows, .text = try gpa.dupe(u8, overlay.text) },
@@ -1990,7 +1990,7 @@ test "terminal edits and undo survive partial history clearing and whole-screen
if (action == .hidden_undo) {
gpa.free(pane.ovl.?.text);
pane.ovl = null;
- panes.Terminal.enterTty(p, 0);
+ panes.terminal.enterTty(p, 0);
}
const bytes = switch (action) {
.clear_history, .partial_clear_history => "\x1b[3J",
@@ -2006,20 +2006,20 @@ test "terminal edits and undo survive partial history clearing and whole-screen
try std.testing.expectEqual(expected + 1, pane.body.cur_row);
try std.testing.expectEqual(expected, pane.body.vsel.row);
}
- for ([_]panes.Terminal.Snapshot{ pane.body.ed_undo[0], pane.body.ed_redo[0] }) |snapshot| {
+ for ([_]panes.terminal.Snapshot{ pane.body.ed_undo[0], pane.body.ed_redo[0] }) |snapshot| {
try std.testing.expectEqual(expected, snapshot.ovl.?.row);
try std.testing.expectEqual(expected + 1, snapshot.cur_row);
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());
- panes.Terminal.undo(p, pane);
+ panes.terminal.undo(p, pane);
try std.testing.expectEqualStrings("edit one\nedit two", pane.ovl.?.text);
try std.testing.expectEqual(expected, pane.ovl.?.row);
}
}
test "terminal lower scroll regions do not move edits above them" {
- if (comptime !panes.Terminal.enabled) return error.SkipZigTest;
+ if (comptime !panes.terminal.enabled) return error.SkipZigTest;
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 });
defer p.deinit();
@@ -2030,23 +2030,23 @@ 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;
- panes.Terminal.pushUndo(p, pane);
- const total = panes.Terminal.scrollbar(pane).total;
+ panes.terminal.pushUndo(p, pane);
+ const total = panes.terminal.scrollbar(pane).total;
var setup: [64]u8 = undefined;
const bytes = try std.fmt.bufPrint(&setup, "\x1b[4;{d}r\x1b[{d};1H", .{ pane.rows, pane.rows });
p.update(.{ .output = .{ .pane = 0, .bytes = bytes } });
p.update(.{ .output = .{ .pane = 0, .bytes = "tail\r\n" ** 50 } });
- try std.testing.expectEqual(total, panes.Terminal.scrollbar(pane).total);
+ try std.testing.expectEqual(total, panes.terminal.scrollbar(pane).total);
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 panes.terminal.screenTextAlloc(pane, gpa);
defer gpa.free(full);
try std.testing.expect(std.mem.startsWith(u8, full, "top\nsecond\nthird\n"));
}
test "terminal eviction and lower-region scrolling in one read preserve a surviving edit" {
- if (comptime !panes.Terminal.enabled) return error.SkipZigTest;
+ if (comptime !panes.terminal.enabled) return error.SkipZigTest;
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 });
defer p.deinit();
@@ -2071,7 +2071,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;
- panes.Terminal.pushUndo(p, pane);
+ panes.terminal.pushUndo(p, pane);
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 });
@@ -3342,11 +3342,11 @@ const TerminalTests = struct {
// Tests asserting raw ANSI indices explicitly select helix, whose palette
// is inherited. Native-palette coverage lives in the overlay/eviction and
// trailing-blank tests and checks their concrete RGB values instead.
- const gridOffset = panes.Terminal.gridOffset;
- const scrollGrid = panes.Terminal.scrollGrid;
- const promptInputReady = panes.Terminal.promptInputReady;
- const forwardKey = panes.Terminal.forwardKey;
- const enterTty = panes.Terminal.enterTty;
+ const gridOffset = panes.terminal.gridOffset;
+ const scrollGrid = panes.terminal.scrollGrid;
+ const promptInputReady = panes.terminal.promptInputReady;
+ const forwardKey = panes.terminal.forwardKey;
+ const enterTty = panes.terminal.enterTty;
// Align normal-mode glyphs with the VT grid and compare their styles.
fn modeStyleDiffs(p: *Pardes, pane: *Pane, gpa: std.mem.Allocator, note: []const u8) !usize {
@@ -4798,7 +4798,7 @@ test "Zig keywords keep every rendered byte colored across line-number widths" {
}
test "terminal overlays preserve trailing blank styles without coloring inserted rows" {
- if (comptime !panes.Terminal.enabled) return error.SkipZigTest;
+ if (comptime !panes.terminal.enabled) return error.SkipZigTest;
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 });
defer p.deinit();