summaryrefslogtreecommitdiff
path: root/test/column_drag.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 02:31:20 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commitf749eb712d990a9b03f1db372d5311e77bd32edd (patch)
treeee4d9966f1eb293054b7ed865c9d4d6eb49e432b /test/column_drag.zig
parent8f6621f9f70db86d56266a59b56dfb92b324b0d9 (diff)
parentb3d32656413734952bc918c2d4cfd12fede6c214 (diff)
downloadpardes-f749eb712d990a9b03f1db372d5311e77bd32edd.tar.gz
pardes-f749eb712d990a9b03f1db372d5311e77bd32edd.zip
integration: the terminal behind src/Term.zig, with the diff viewer and the plumber's first phase
A merge of term-phase0 and pardes-next. File.zig's recolorSyntax keeps the theme's grounds and names Term.Filter and Term.Span; the changelog keeps both sides' entries, the palette sentence in the place of the entry the terminal work cut down. core-test 985/985 on tui; the diff, pager and tree process cases pass, goldens unchanged. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'test/column_drag.zig')
-rw-r--r--test/column_drag.zig58
1 files changed, 6 insertions, 52 deletions
diff --git a/test/column_drag.zig b/test/column_drag.zig
index e64656e3..a12ca16f 100644
--- a/test/column_drag.zig
+++ b/test/column_drag.zig
@@ -84,7 +84,6 @@ test "column grip drag moves only its interval and keeps tag caret with the colu
try std.testing.expect(p.view().drag == .column_move);
mouse(p, .drag, target);
_ = try p.render(frame.allocator());
- try std.testing.expectEqual(p.view().col_w[3] - pardes.TAG_TEXT_INSET - 1, (try tagLayer(p, 3)).viewport.w);
try std.testing.expectEqual(last_rect, p.view().rects[p.view().cols[3].panes[0]]);
try std.testing.expectEqual(last_columns, (try tagLayer(p, 3)).cols);
try expectOrder(p, &before, &.{ 0, 1, 2, 3 });
@@ -121,7 +120,7 @@ test "column grip drag moves only its interval and keeps tag caret with the colu
try std.testing.expect(p.view().drag == .none);
}
-test "column grip is separate from compact text and the resize seam" {
+test "column grip is separate from compact text" {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 24 });
defer p.deinit();
_ = try p.setTestFile("body\n");
@@ -160,11 +159,6 @@ test "column grip is separate from compact text and the resize seam" {
mouse(p, .press, p.view().col_x[1] + config.GUTTER - 1);
try std.testing.expect(p.view().drag == .column_move);
mouse(p, .release, p.view().col_x[1] + config.GUTTER - 1);
- const seam = p.view().col_x[0] + p.view().col_w[0] - 1;
- const body_row = p.view().rects[p.view().cols[0].panes[0]].y + pardes.BOX_H + 1;
- p.update(.{ .mouse = .{ .button = .left, .kind = .press, .col = seam, .row = body_row } });
- try std.testing.expect(p.view().drag == .border_v);
- p.update(.{ .mouse = .{ .button = .left, .kind = .release, .col = seam, .row = body_row } });
}
test "column grips stay blank, and muted across focus and hover until grabbed" {
@@ -238,32 +232,7 @@ test "column grip dropped in its own place moves the column's left edge" {
try std.testing.expectEqual(serials[0], p.view().cols[1].serial);
}
-/// The column of the drag preview's rail, checked to run the full height
-/// below the workspace tag in the grabbed grip's color, except through the
-/// grip and pane boxes at the window's left edge.
-fn previewRail(p: *Pardes, frame: *std.heap.ArenaAllocator) !?u16 {
- _ = frame.reset(.retain_capacity);
- const surface = try p.render(frame.allocator());
- const lit: pardes.Color = .{ .rgb = p.chromeTheme().column_box };
- var found: ?u16 = null;
- for (0..surface.cols) |x| {
- if (!std.mem.eql(u8, surface.at(@intCast(x), surface.rows - 1).grapheme(), "╎")) continue;
- try std.testing.expect(found == null);
- found = @intCast(x);
- for (p.topBarHeight()..surface.rows) |row| {
- const cell = surface.at(@intCast(x), @intCast(row));
- if (x < config.GUTTER and cell.style.font_role == .tagline) {
- try std.testing.expect(!std.mem.eql(u8, cell.grapheme(), "╎"));
- continue;
- }
- try std.testing.expectEqualStrings("╎", cell.grapheme());
- try std.testing.expectEqual(lit, cell.style.fg);
- }
- }
- return found;
-}
-
-test "column grip drag previews where the column lands, in the seam beside its rule" {
+test "column grip drag lands where it is carried, lighting no word on the way" {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 24 });
defer p.deinit();
_ = try p.setTestFile("body\n");
@@ -278,15 +247,10 @@ test "column grip drag previews where the column lands, in the seam beside its r
_ = try p.render(frame.allocator());
const serials = .{ p.view().cols[0].serial, p.view().cols[1].serial, p.view().cols[2].serial };
- // Held on its own grip it lands nowhere new: no rail.
+ // Over the first column's left half it goes first.
mouse(p, .press, p.view().col_x[1]);
- mouse(p, .drag, p.view().col_x[1] + 1);
- try std.testing.expectEqual(@as(?u16, null), try previewRail(p, &frame));
- // Over the first column's left half it goes first. The window edge has
- // no seam, and the gutter there is the GUI's scroll rail, so the rail
- // runs in the gutter's last cell.
mouse(p, .drag, 3);
- try std.testing.expectEqual(@as(?u16, config.GUTTER - 1), try previewRail(p, &frame));
+ _ = try p.render(frame.allocator());
// The pointer is over the first column's "New", but a carried column
// aims at a place: no word lights under it.
for (0..p.view().screen_w) |x| try std.testing.expect(!std.meta.eql(p.surface.at(@intCast(x), pardes.TOPBAR_H).style.bg, pardes.Color{ .rgb = p.theme().sel_bg }));
@@ -294,28 +258,18 @@ test "column grip drag previews where the column lands, in the seam beside its r
try std.testing.expectEqual(serials[1], p.view().cols[0].serial);
try std.testing.expectEqual(serials[0], p.view().cols[1].serial);
- // Past the middle column's middle it lands after it: the rail is in the
- // seam cell left of the last column's rule, where a border drag's is.
+ // Past the last column's middle it goes last.
mouse(p, .press, p.view().col_x[0]);
- const past = p.view().col_x[1] + p.view().col_w[1] - 2;
- mouse(p, .drag, past);
- try std.testing.expectEqual(@as(?u16, p.view().col_x[2] - 1), try previewRail(p, &frame));
- // Past the last column's middle: the window's last cell.
mouse(p, .drag, p.view().col_x[2] + p.view().col_w[2] - 1);
- try std.testing.expectEqual(@as(?u16, p.view().screen_w - 1), try previewRail(p, &frame));
mouse(p, .release, p.view().col_x[2] + p.view().col_w[2] - 1);
try std.testing.expectEqual(serials[0], p.view().cols[0].serial);
try std.testing.expectEqual(serials[2], p.view().cols[1].serial);
try std.testing.expectEqual(serials[1], p.view().cols[2].serial);
- // Short of a neighbour's middle the left edge moves, and the preview
- // is the seam that edge will have: exactly where the release puts it.
+ // Short of a neighbour's middle the left edge moves.
const edge = p.view().col_x[2];
mouse(p, .press, edge + 1);
- mouse(p, .drag, edge + 1 - 6);
- try std.testing.expectEqual(@as(?u16, edge - 6 - 1), try previewRail(p, &frame));
mouse(p, .release, edge + 1 - 6);
_ = try p.render(frame.allocator());
try std.testing.expectEqual(edge - 6, p.view().col_x[2]);
- try std.testing.expectEqual(@as(?u16, null), try previewRail(p, &frame));
}