summaryrefslogtreecommitdiff
path: root/test/column_drag.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 00:13:11 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:14 -0300
commit42748f92b77367db415c8b4d0f2e537a9e1ddde7 (patch)
tree3ff6606d33149581d5954dcc900eb6ab3e4f0f17 /test/column_drag.zig
parent23f430573efe4f6ef55b0180aa0d742ff4eca1d9 (diff)
downloadpardes-42748f92b77367db415c8b4d0f2e537a9e1ddde7.tar.gz
pardes-42748f92b77367db415c8b4d0f2e537a9e1ddde7.zip
Make the column and workspace tags Texts with the pane tag's keys
The headers had their own one-line editor with its own keys: Enter always executed, h/l and J/K moved between headers and panes, Ctrl-c/x/v cut and pasted, and TagLine refused a newline that 9P accepted. They are now Texts like a pane's tag, with no prefix and a default until edited, so normal and insert mode, undo and the look and execute keys are the body's. Moving between them is the window keys' job: Up from a pane with nothing above it reaches its column's tag and then the workspace's, Down comes back, and Left and Right walk the column tags. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/column_drag.zig')
-rw-r--r--test/column_drag.zig22
1 files changed, 11 insertions, 11 deletions
diff --git a/test/column_drag.zig b/test/column_drag.zig
index b2b8f35d..f128aa61 100644
--- a/test/column_drag.zig
+++ b/test/column_drag.zig
@@ -26,7 +26,7 @@ const Snapshot = struct {
serial: u32,
panes: [pardes.MAX_PANES]usize = undefined,
count: usize,
- tag: pardes.TagLine,
+ tag: []const u8,
};
fn expectOrder(p: *Pardes, before: []const Snapshot, order: []const usize) !void {
@@ -37,7 +37,7 @@ fn expectOrder(p: *Pardes, before: []const Snapshot, order: []const usize) !void
try std.testing.expectEqual(saved.serial, p.col_serial[column]);
try std.testing.expectEqual(saved.count, p.col_n[column]);
try std.testing.expectEqualSlices(usize, saved.panes[0..saved.count], p.col_panes[column][0..p.col_n[column]]);
- try std.testing.expectEqualStrings(saved.tag.slice(""), p.col_tags[column].slice(""));
+ try std.testing.expectEqualStrings(saved.tag, p.columnTag(column));
}
}
@@ -59,7 +59,7 @@ test "column grip drag moves only its interval and keeps tag caret with the colu
try std.testing.expectEqual(@as(usize, 2), p.col_n[1]);
for ([_]u64{ 2, 3, 5, 7 }, 0..) |weight, column| {
p.col_weight[column] = weight;
- try std.testing.expect(p.col_tags[column].set(([_][]const u8{ "zero column header", "one column header", "two column header", "three column header" })[column]));
+ p.col_tags[column].own = try p.gpa.dupe(u8, ([_][]const u8{ "zero column header", "one column header", "two column header", "three column header" })[column]);
}
p.update(.tick);
var frame = std.heap.ArenaAllocator.init(p.gpa);
@@ -67,7 +67,7 @@ test "column grip drag moves only its interval and keeps tag caret with the colu
_ = try p.render(frame.allocator());
var before: [4]Snapshot = undefined;
for (&before, 0..) |*saved, column| {
- saved.* = .{ .weight = p.col_weight[column], .serial = p.col_serial[column], .count = p.col_n[column], .tag = p.col_tags[column] };
+ saved.* = .{ .weight = p.col_weight[column], .serial = p.col_serial[column], .count = p.col_n[column], .tag = p.columnTag(column) };
@memcpy(saved.panes[0..saved.count], p.col_panes[column][0..saved.count]);
}
const layer = try tagLayer(p, 1);
@@ -75,8 +75,8 @@ test "column grip drag moves only its interval and keeps tag caret with the colu
p.update(.{ .mouse = headerMouse(layer, 10, .press) });
p.update(.{ .mouse = headerMouse(layer, 10, .release) });
try std.testing.expectEqual(@as(?usize, 1), p.header_column);
- const caret = p.topbar_col;
- const anchor = p.header_anchor;
+ const caret = p.focusedHeader().?.cur_col;
+ const anchor = p.focusedHeader().?.vsel;
const scroll = p.header_scroll;
const target = p.col_x[3] + p.col_w[3] - 2;
const last_rect = p.rects[p.col_panes[3][0]];
@@ -93,14 +93,14 @@ test "column grip drag moves only its interval and keeps tag caret with the colu
try expectOrder(p, &before, &.{ 0, 2, 3, 1 });
try std.testing.expectEqual(active, p.active);
try std.testing.expectEqual(@as(?usize, 3), p.header_column);
- try std.testing.expectEqual(caret, p.topbar_col);
- try std.testing.expectEqual(anchor, p.header_anchor);
+ try std.testing.expectEqual(caret, p.focusedHeader().?.cur_col);
+ try std.testing.expectEqual(anchor, p.focusedHeader().?.vsel);
try std.testing.expectEqual(scroll, p.header_scroll);
// The old tag envelope must not edit the new occupant of its old index,
// including the interval before hosts request another rendered frame.
p.update(.{ .mouse = stale });
try std.testing.expectEqual(@as(?usize, 3), p.header_column);
- try std.testing.expectEqual(caret, p.topbar_col);
+ try std.testing.expectEqual(caret, p.focusedHeader().?.cur_col);
_ = try p.render(frame.allocator());
try std.testing.expectEqual(before[1].serial, (try tagLayer(p, 3)).serial);
try std.testing.expectEqual(p.col_w[3] - pardes.TAG_TEXT_INSET, (try tagLayer(p, 3)).viewport.w);
@@ -110,7 +110,7 @@ test "column grip drag moves only its interval and keeps tag caret with the colu
mouse(p, .release, back);
try expectOrder(p, &before, &.{ 0, 1, 2, 3 });
try std.testing.expectEqual(@as(?usize, 1), p.header_column);
- try std.testing.expectEqual(caret, p.topbar_col);
+ try std.testing.expectEqual(caret, p.focusedHeader().?.cur_col);
try std.testing.expectEqual(active, p.active);
// A structural change between press and release must not retarget the
// in-flight drag to whichever column now occupies the original index.
@@ -165,7 +165,7 @@ test "column grip is separate from compact text and the resize seam" {
try std.testing.expect(p.drag != .column_move);
try std.testing.expect(p.header_drag);
p.update(.{ .mouse = headerMouse(layer, 0, .release) });
- try std.testing.expectEqual(@as(?u16, 0), p.topbar_col);
+ try std.testing.expectEqual(@as(i32, 0), p.focusedHeader().?.cur_col);
mouse(p, .press, p.col_x[1] + config.GUTTER - 1);
try std.testing.expect(p.drag == .column_move);
mouse(p, .release, p.col_x[1] + config.GUTTER - 1);