diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-16 22:17:47 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-16 22:32:11 -0300 |
| commit | 266515537a917154ef4736a1d6b1cc97be23fced (patch) | |
| tree | 9e0a10c3abd0c8911182c8b071f692e0b09a9310 /test/column_drag.zig | |
| parent | fc38c73c59f7855a4caad8aa4d3bb8e023309c13 (diff) | |
| download | pardes-266515537a917154ef4736a1d6b1cc97be23fced.tar.gz pardes-266515537a917154ef4736a1d6b1cc97be23fced.zip | |
mouse: no drag guides, and columns resize by their grips alone
A drag draws no guide lines: the dashes where a pane or column would land, the carried column's rail and the held seam's dashes are gone, with the guide region kind, Surface.overlayDash, the rail's Region.clip and MAX_GUIDES; the gui's floating draw group is the debug box's alone.
The line between two columns is no resize handle: Drag.border_v and its corner variant are gone, with clampBorderCol and the unused chromeTarget. A press there is a press in the pane under it (a sweep). A column resizes by its grip, a pane by its grip or, in a window, the rule above it (border_h, unchanged).
Tests: the corner and border-drag unit tests and the cornerdrag and cornerdrag-left tty cases are deleted; windowops loses its border drag and tagalign2col widens its column by the grip; colgrip, shrinktag and windowops goldens drop the guides; a unit test pins that a press on the line between columns sweeps and resizes nothing. The cheatsheet, themes, render-pipeline notes and changelog say so.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/column_drag.zig')
| -rw-r--r-- | test/column_drag.zig | 58 |
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)); } |
