diff options
Diffstat (limited to 'test/process/tty_layout.zig')
| -rw-r--r-- | test/process/tty_layout.zig | 141 |
1 files changed, 14 insertions, 127 deletions
diff --git a/test/process/tty_layout.zig b/test/process/tty_layout.zig index 84f76be7..08a02488 100644 --- a/test/process/tty_layout.zig +++ b/test/process/tty_layout.zig @@ -5,8 +5,6 @@ const Tty = @import("../tty.zig").Tty; pub const cases = .{ .{ "tty layout: colgrip", colgrip }, .{ "tty layout: collapse", collapse }, - .{ "tty layout: cornerdrag", cornerdrag }, - .{ "tty layout: cornerdrag-left", cornerdrag_left }, .{ "tty layout: delask", delask }, .{ "tty layout: emptycol", emptycol }, .{ "tty layout: layout-close", layout_close }, @@ -20,7 +18,7 @@ pub const cases = .{ }; // Column grips: the two cells left of a column tag carry the column. A grabbed -// grip lights, and a rail in its color stands where the column will land. +// grip lights. // The right column is at x 50; its grip is cells 51-52 (1-based) on row 2. fn colgrip(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var t = try Tty.init(gpa, exe, "colgrip"); @@ -34,12 +32,11 @@ fn colgrip(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.key("a-c"); try t.stable(700, 15000); try t.style("rest"); - // held on its own grip: lit, and no rail, since it lands where it is + // held on its own grip: lit try t.press("left", "51", 2); try t.stable(400, 5000); try t.style("held"); - // dropped short of the left column's middle, the left edge moves: the rail is - // in the seam cell left of where the column's rule will be + // dropped short of the left column's middle, the left edge moves try t.drag("left", "41", 2); try t.stable(400, 5000); try t.snap("resize-drag"); @@ -47,8 +44,7 @@ fn colgrip(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.release("left", "41", 2); try t.stable(700, 15000); try t.snap("resize-done"); - // carried over the left column's left half it goes first; the window edge - // has no seam, so the rail runs in the gutter's last cell + // carried over the left column's left half it goes first try t.press("left", "41", 2); try t.drag("left", "10", 2); try t.stable(400, 5000); @@ -107,109 +103,6 @@ fn collapse(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.done(); } -// corner grabs: where a column edge crosses a pane edge, ONE drag moves both. -// Only the left column's h-splits make a corner — the v handle IS that column's -// last cell, so that is the only pane pair whose horizontal hint runs through -// it, and a corner therefore sits exactly where the two lines visibly cross. -// The layout is windowops': col 0 (x 0, w 50) holds panes 0 (rows 1-15) and 1 -// (rows 16-29), col 1 holds one pane. The corner is col 49, row 15. -fn cornerdrag(gpa: std.mem.Allocator, exe: [:0]const u8) !void { - var t = try Tty.init(gpa, exe, "cornerdrag"); - defer t.deinit(); - try t.file("w.txt", "x"); - try t.start(31, 100, &.{ "-n", "3" }); - try t.wait(8000, "w.txt"); - try t.stable(700, 20000); - // hover the corner: no hints (columns resize by their grips); the frame - // stays empty - try t.motion("50", 16); - try t.stable(400, 5000); - try t.snap("hover-corner"); - // CONTROL: the same vertical edge ten rows off the crossing is a plain edge. - // The identical diagonal drag moves the column and nothing else — pane 0 still - // ends on row 15, and the preview is one dash, not two - try t.press("left", "50", 7); - try t.drag("left", "30", 25); - try t.stable(400, 5000); - try t.snap("edge-drag"); - try t.release("left", "30", 25); - try t.motion("45", 25); - try t.stable(500, 8000); - try t.snap("edge-done"); - // the corner itself, now at col 0's new last col (29) and still row 15: drag it - // up and to the right and both boundaries follow the one mouse - try t.press("left", "30", 17); - try t.drag("left", "60", 9); - try t.stable(400, 5000); - try t.snap("corner-drag"); - try t.release("left", "60", 9); - try t.motion("45", 25); - try t.stable(500, 8000); - try t.snap("corner-done"); - // clamp interaction, half one: shove the corner off the right edge while - // staying mid-height. The column preview parks at its MINW stop; the row - // preview keeps tracking the mouse exactly - try t.press("left", "60", 9); - try t.drag("left", "99", 21); - try t.stable(400, 5000); - try t.snap("clamp-x"); - // half two, the mirror: below the bottom at mid-width. Now the ROW preview - // parks (the lower pane keeps its tag row) and the COLUMN keeps tracking - try t.drag("left", "60", 31); - try t.stable(400, 5000); - try t.snap("clamp-y"); - try t.release("left", "60", 31); - try t.motion("45", 25); - try t.stable(500, 8000); - try t.snap("clamp-done"); - try t.done(); -} - -// corner grabs on the RIGHT column's side of the v border. The v handle is the -// LEFT column's last cell, so that column's own h hint runs THROUGH it while the -// right column's hints start one cell further right — the crossing there reads as -// a T butting into the junction rather than a full cross, and it is grabbable all -// the same: one drag moves the column edge and the RIGHT column's pane edge. -// Layout: windowops' -n 3 (col 0 x 0 w 50, panes on rows 1-15 and 16-29; col 1 -// x 50 w 50), then focus right and Alt-n so col 1 holds two panes as well, split -// at ITS own row. The two corners on col 49 are then row 16 (col 0's seam, the -// one that already worked) and row 5 (col 1's, the one this script is about). -fn cornerdrag_left(gpa: std.mem.Allocator, exe: [:0]const u8) !void { - var t = try Tty.init(gpa, exe, "cornerdrag-left"); - defer t.deinit(); - try t.file("w.txt", "x"); - try t.start(31, 100, &.{ "-n", "3" }); - try t.wait(8000, "w.txt"); - try t.stable(700, 20000); - // a second pane in the RIGHT column - try t.key("c-w l enter"); - try t.stable(400, 5000); - try t.key("a-n"); - try t.stable(700, 15000); - try t.snap("right-split"); - // hover col 1's corner: hovering draws no hints any more, so the frame is - // empty; the drags below still show their previews - try t.motion("50", 5); - try t.stable(400, 5000); - try t.snap("hover-corner"); - // CONTROL: col 0's own seam, hovered: no hint either - try t.motion("50", 16); - try t.stable(400, 5000); - try t.snap("hover-left-corner"); - // grab col 1's corner and drag down-left: the column preview and col 1's row - // preview both follow the one mouse, the row dashes lying to the RIGHT of the v - // line because they are the right column's - try t.press("left", "50", 6); - try t.drag("left", "30", 13); - try t.stable(400, 5000); - try t.snap("corner-drag"); - try t.release("left", "30", 13); - try t.motion("45", 25); - try t.stable(500, 8000); - try t.snap("corner-done"); - try t.done(); -} - // Del from the keyboard on a pane with open panes above AND below asks, on the // pane's notice band, which one takes its rows: k above, j below, anything else // keeps the pane. A click, and DelAbove/DelBelow (Del k / Del j), never ask. @@ -479,8 +372,8 @@ fn shrinktag(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.motion("40", 25); try t.stable(500, 8000); try t.snap("shrunk"); - // the shrunk pane's gutter box grabs a move: preview one into the right - // column, abort by releasing over the pane itself + // the shrunk pane's gutter box grabs a move: carried into the right column + // nothing shows until the release, aborted by releasing over the pane itself try t.press("left", "1", 3); try t.drag("left", "70", 9); try t.stable(400, 5000); @@ -576,10 +469,11 @@ fn tagalign2col(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.key("a-n"); try t.stable(700, 15000); try t.snap("aligned"); - // Resizing moves the right column as a whole and clips without hidden spaces. - try t.press("left", "80", 11); - try t.drag("left", "100", 11); - try t.release("left", "100", 11); + // Resizing by the right column's grip moves it as a whole and clips + // without hidden spaces. + try t.press("left", "81", 2); + try t.drag("left", "101", 2); + try t.release("left", "101", 2); try t.stable(700, 15000); try t.snap("widened"); try t.done(); @@ -665,7 +559,7 @@ fn windownav(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.done(); } -// hover (no hints), border drags, grip resize, move drag, Alt-n, Ctrl-w focus (window mode), Debug box +// hover (no hints), grip resize, move drag, Alt-n, Ctrl-w focus (window mode), Debug box fn windowops(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var t = try Tty.init(gpa, exe, "windowops"); defer t.deinit(); @@ -681,14 +575,6 @@ fn windowops(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.motion("20", 16); try t.stable(400, 5000); try t.snap("hover-h"); - // drag the vertical border 10 cols left - try t.press("left", "50", 11); - try t.drag("left", "40", 11); - try t.stable(400, 5000); - try t.snap("border-drag"); - try t.release("left", "40", 11); - try t.stable(500, 8000); - try t.snap("border-done"); // resize the left pair by the lower pane's grip, 4 rows up (a terminal has no // rule between panes; pane 0's last row is now 13) try t.press("left", "1", 18); @@ -696,7 +582,8 @@ fn windowops(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.release("left", "1", 14); try t.stable(500, 8000); try t.snap("hborder-done"); - // move pane 1 (its gutter box) into the right column + // move pane 1 (its gutter box) into the right column: nothing shows until + // the release try t.press("left", "1", 18); try t.drag("left", "70", 9); try t.stable(400, 5000); |
