diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 02:31:20 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | f749eb712d990a9b03f1db372d5311e77bd32edd (patch) | |
| tree | ee4d9966f1eb293054b7ed865c9d4d6eb49e432b /test/process | |
| parent | 8f6621f9f70db86d56266a59b56dfb92b324b0d9 (diff) | |
| parent | b3d32656413734952bc918c2d4cfd12fede6c214 (diff) | |
| download | pardes-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/process')
| -rw-r--r-- | test/process/tree.zig | 2 | ||||
| -rw-r--r-- | test/process/tty_editing.zig | 24 | ||||
| -rw-r--r-- | test/process/tty_images.zig | 2 | ||||
| -rw-r--r-- | test/process/tty_layout.zig | 141 |
4 files changed, 40 insertions, 129 deletions
diff --git a/test/process/tree.zig b/test/process/tree.zig index d28ac1ed..8fe3d881 100644 --- a/test/process/tree.zig +++ b/test/process/tree.zig @@ -105,7 +105,7 @@ fn discovery(gpa: std.mem.Allocator, exe: [:0]const u8) !void { const top = try c.list(a, "/"); // A set: which files the root holds, not the order a listing gives. - const want = [_][]const u8{ "README", "index", "status", "focus", "ctl", "commands", "recent", "dumps", "addons", "look", "exec", "pager", "log", "screen", "listeners", "sessions", "layout", "tag", "tagexec", "kbdin", "mousein", "pane", "col", "os" }; + const want = [_][]const u8{ "README", "index", "status", "focus", "ctl", "commands", "recent", "dumps", "addons", "look", "exec", "pager", "log", "screen", "listeners", "sessions", "layout", "tag", "tagexec", "kbdin", "mousein", "plumb", "pane", "col", "os" }; var others: usize = 0; for (top) |n| { if (contains(&.{ "src", "shaders" }, n)) continue; diff --git a/test/process/tty_editing.zig b/test/process/tty_editing.zig index 72cbb573..b5f0495c 100644 --- a/test/process/tty_editing.zig +++ b/test/process/tty_editing.zig @@ -35,6 +35,7 @@ pub const cases = .{ .{ "tty editing: lsp-rename-files", lsp_rename_files }, .{ "tty editing: callstack", callstack }, .{ "tty editing: diffview", diffview }, + .{ "tty editing: diffstack", diffstack }, .{ "tty editing: dirpane", dirpane }, .{ "tty editing: scrolloff", scrolloff }, .{ "tty editing: wrap", wrap }, @@ -2018,6 +2019,29 @@ fn diffview(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.done(); } +// A diff paged (`pardes -`) is stacked in a +Diff: its hunk found where the +// file has moved it since (two lines further down), under the declaration it +// stands in (`a.zig:3`, `const S = struct {`) and its label one level deep +// (`a.zig:5 *`); a changed line's changed word on a stronger ground in both +// lines (`c` and `a`), and a line added whole (`log();`) on a faint one, each +// marker in its tint's hue. +fn diffstack(gpa: std.mem.Allocator, exe: [:0]const u8) !void { + var t = try Tty.init(gpa, exe, "diffstack"); + defer t.deinit(); + try t.file("a.zig", "// one\n// two\nconst S = struct {\n fn f() void {\n a();\n b();\n log();\n }\n};\n"); + try t.file("change.patch", "--- a.zig\n+++ a.zig\n@@ -3,4 +3,5 @@ git's guess\n fn f() void {\n- c();\n+ a();\n b();\n+ log();\n }\n"); + try t.start(31, 100, &.{}); + try t.wait(8000, "$"); + try t.stable(700, 20000); + try t.send("cat change.patch | $(readlink /proc/$PPID/exe) -"); + try t.key("enter"); + try t.wait(20000, "a.zig:5 *"); + try t.stable(700, 20000); + try t.snap("diff-stack"); + try t.style("diff-stack-colours"); + try t.done(); +} + // a look at a directory opens a pane named for it with a trailing /, its // entries in columns as acme's directory window lays them out: down each // column first, a directory's marked /, dotfiles shown. A look at an entry diff --git a/test/process/tty_images.zig b/test/process/tty_images.zig index dea9feef..5c39d4f3 100644 --- a/test/process/tty_images.zig +++ b/test/process/tty_images.zig @@ -50,7 +50,7 @@ fn images(gpa: std.mem.Allocator, exe: [:0]const u8) !void { // the tag takes an edit like any other pane's now — nothing live left in it to // protect, so the image early-return in enterTagEdit is gone. The image-state // prefix is wider than this source-local column, so widen the grid for this - // final assertion. (A column-border drag intentionally takes width from only + // final assertion. (A column grip drag intentionally takes width from only // one neighbour, which cannot expose this 82-column prefix.) Then click the // visible tail itself, at its `Term`. This proves the image tag is an ordinary // editor rather than accidentally typing at a clipped read-only path. 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); |
