summaryrefslogtreecommitdiff
path: root/test/panes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 22:57:53 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commit2586e804e4df670bf6a5072ec776d9fc00c1c4b9 (patch)
tree8b5b5369e8a8653b1dd2ac4952a152f4afeec830 /test/panes.zig
parent692ea930553e375bdbac874da93893b02b8725b3 (diff)
downloadpardes-2586e804e4df670bf6a5072ec776d9fc00c1c4b9.tar.gz
pardes-2586e804e4df670bf6a5072ec776d9fc00c1c4b9.zip
A tag that exactly fills its row stays one row, as acme's does
Tags wrapped one cell early to keep a cell for the caret past a full row, so a tag that exactly filled its column broke as De / l. acme's frame wraps a box only when it is wider than what the row has left, and frptofchar clamps the tick past a full line's end to the frame's edge. Tags now wrap at their full width; the caret past a full row sits at the tag layer's edge, and on the pane's last cell in a terminal grid, which has none past it. Two tiny-screen tests collapse their tags, as the others do, and the 41 goldens that moved were re-recorded by name after the same check: rows shift back up under the shorter tags and nothing else changes. chordcut's file-body clicks moved back with them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/panes.zig')
-rw-r--r--test/panes.zig26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/panes.zig b/test/panes.zig
index f00b35c4..25f0f6db 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -1733,6 +1733,32 @@ test "paste into pane commands and prompts never inserts into the body" {
try std.testing.expect(std.mem.indexOf(u8, pardes.tagline.curTail(pane), " Custom\nCommand") != null);
}
+test "a tag that exactly fills its row stays one row, its caret at the edge as acme's tick" {
+ const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 50, .rows = 12 });
+ defer p.deinit();
+ const pane = try p.setTestFile("body\n");
+ const width = pardes.tagline.tagWidth(p, 0);
+ // Pad the path until the whole tag is exactly the row.
+ const bare = try pardes.tagline.tagText(p, p.scratch.allocator(), pane);
+ const pad = width - bare.len + pane.file.?.path.len;
+ p.gpa.free(pane.file.?.path);
+ const path = try p.gpa.alloc(u8, pad);
+ @memset(path, 'a');
+ path[0] = '/';
+ pane.file.?.path = path;
+ try std.testing.expectEqual(width, (try pardes.tagline.tagText(p, p.scratch.allocator(), pane)).len);
+ p.update(.{ .key = .{ .cp = ':' } });
+ p.update(.{ .key = .{ .cp = 'A' } });
+ var arena = std.heap.ArenaAllocator.init(p.gpa);
+ defer arena.deinit();
+ const surface = try p.render(arena.allocator());
+ try std.testing.expectEqual(@as(u16, 1), pane.tag_rows);
+ // The layer's caret is past the last character; the grid's, on the pane's
+ // last cell, since it has none past it.
+ try std.testing.expectEqual(@as(u16, @intCast(width)), surface.tag_layers[0].cursor.?.x);
+ try std.testing.expectEqual(p.rects[0].x + p.rects[0].w - 1, surface.cursor.?.x);
+}
+
test "a long pane tag wraps onto rows, and a click on a wrapped row maps to the whole tag's address" {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 50, .rows = 12 });
defer p.deinit();