diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-25 00:24:12 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-25 00:34:18 -0300 |
| commit | 0919fcef12f973d3129b32f79a331ff8e45cb7ac (patch) | |
| tree | a725fa0db7529fd50a173cbcd89120eb91153211 /test/behaviour | |
| parent | 8474b3a7c16cdac242f362144d100931f149ad6f (diff) | |
| download | pardes-0919fcef12f973d3129b32f79a331ff8e45cb7ac.tar.gz pardes-0919fcef12f973d3129b32f79a331ff8e45cb7ac.zip | |
Command: `:` opens a command line in the focused pane's tag, its rows the tag's own words then the commands a helix hand types, each the pardes word it runs (walk UI, pick-ui SPEC.md §8, item 1 of line E2): `:` from a body is a text prompt of its own (Prompt.zig's `.command`, its state Command.zig in TagState.prompt.command), drawn after a `:` key cell in the tag's head, the plain word the line is (`= Exec Save`, `= Exec Theme acme`, `= Look :12`, `= Exec Edit |sort`), the count (`16 commands`, or what a command takes: `<theme>`, `⏎ runs it`); its rows in the band: the tag's own words in the tag's order (its text after the prefix but `|`, then `Kill` for a terminal whose tag has none), each `in the tag`, the last underlined as the rule off the rest, then `write w`, `quit q`, `theme`, `set`, `sort`, `reflow`, `goto g`, `open o`, `pipe`, `reload`, `toggle` with what each takes on the right (`<theme>`, `<setting>`, `<line>`, ...), filtered by the field's first word with the query pane's scorer (Names.match) in their own order, the query's bytes in the match tint, eleven around the current one; beside them the current row's doc (a builtin's from the registry, a command's own, naming the word it runs); Tab and S-Tab write the next or the last row into the field, a command with a space after it, the rows staying the line's from before so Tab steps on through them (a click on a row the same, TagState.point); Enter keeps the line in `:`'s history (Pardes.prompt_history.command) and register `:`, puts the tag at rest and runs it as B2 runs a word (exec_cmd, look_cmd): `write [path]` Save, `quit` Del, `theme X` Theme X, `set W v` the setting's word with its value (any case typed), `toggle W` the word bare, `reload` Get, `goto N` Look `:N`, `open F` Look F, `sort`, `reflow [N]` and `pipe cmd` each selection piped as `|` does (`sort`, `fmt -w N`, 80 by default; Pipe.submit, a file's text only), anything else the line Exec'd (a builtin by name, else a command pane); what cannot run is said (`goto: a line number`, `set: no such setting`); `:` on the empty field gives the keyboard to the tag's own text as `:` did before (tagline.enterTag), and `:` there gives it back; `lsp-restart` is not a command: pardes has no word that restarts a language server; Esc in a tag keeps today's meaning (Last): four tests pin it after a click in a tag (tty collapse, tty tagcmd's rename, mouse's double-click, mode's tag Exec); THE TEST SITES that typed `:` from a body to reach the tag now type `::` (44): core/Pipe.zig "| in a tag pipes the tag's own text", test/panes.zig "paste into pane commands and prompts" and "a tag that exactly fills its row", test/behaviour/tags.zig 24 (lines 28 41 53 66 84 93 95 99 108 122 128 137 139 143 156 158 160 162 173 182 194 223 253 440), test/behaviour/keys.zig 41 271 373, test/behaviour/panes.zig 253, test/process/tty_editing.zig 112 1376 1392 2379 2393 2436 2453 2459 2540 2579, tty_terminals.zig 429 453, tty_layout.zig 439; those typing `:` in a tag to come back, or window mode's `:`, are as they were; golden ttytaken: the echoed command two cells to the right (the `:` band takes the terminal's rows for a step and gives them back, so its pty shrinks and grows and bash redraws its line: A's band pushes a terminal's body as any pane's); TEST FIRST: Command.zig ": opens a field in the tag after its key cell ..." and ": on the empty field gives the keyboard to the tag's own text ..." (on the base `:` gives the tag the keyboard: no prompt); core-test 1021/1188 (167 skipped), pane-test 182/184, behaviour-test 274/277 (the failures A's, as on E's tip), shell-test 1235/1238, process-test the base's five (find, builtins, leader, tagnav, ttyhelp) and none of mine
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/behaviour')
| -rw-r--r-- | test/behaviour/keys.zig | 6 | ||||
| -rw-r--r-- | test/behaviour/panes.zig | 2 | ||||
| -rw-r--r-- | test/behaviour/tags.zig | 48 |
3 files changed, 28 insertions, 28 deletions
diff --git a/test/behaviour/keys.zig b/test/behaviour/keys.zig index e8731d2c..60c1c42d 100644 --- a/test/behaviour/keys.zig +++ b/test/behaviour/keys.zig @@ -38,7 +38,7 @@ test "keys: a prompt's entry and cancellation leave the tag, the body and its cu // Save on a scratch asks for a path, starting from its directory. const scratch = try s.newPane(); const scratch_tag = try s.read(s.at("/pane/{d}/tag", .{scratch})); - try s.keys(":\tzq"); + try s.keys("::\tzq"); _ = try s.where("/zq"); try s.expect(s.at("/pane/{d}/tag", .{scratch}), scratch_tag); try s.keys("\x1b"); @@ -268,7 +268,7 @@ test "keys: Save's prompt on a scratch starts from the scratch's directory, one // New from the file's pane: a scratch in its directory. try s.write(s.at("/pane/{d}/exec", .{n}), "New\n"); try std.testing.expect(try s.focused() != n); - try s.keys(":\tzq"); + try s.keys("::\tzq"); _ = try s.where(c[1]); try s.keys("\x1b"); } @@ -370,7 +370,7 @@ test "keys: a PDF in normal mode keeps : (its tag and back), SPC (a leader, canc try std.testing.expect(try s.cursor() == null); _ = try s.pdfPage(n); const tag = (try s.where("[1/"))[1]; - try s.keys(":"); + try s.keys("::"); // On its tag, which runs to three rows (its path, the core's art words). const on_tag = (try s.cursor()).?[1]; try std.testing.expect(on_tag >= tag and on_tag <= tag + 2); diff --git a/test/behaviour/panes.zig b/test/behaviour/panes.zig index 4d4c812c..ece65efe 100644 --- a/test/behaviour/panes.zig +++ b/test/behaviour/panes.zig @@ -250,7 +250,7 @@ test "panes: Collapse keeps the text and folds the pane to its tag, and again re try s.expect(s.at("/pane/{d}/body", .{n}), "keep this text\n"); try s.expect(s.at("/pane/{d}/dirty", .{n}), "0\n"); // Its tag still takes the keyboard, the cursor on the tag's row. - try s.keys(":"); + try s.keys("::"); try std.testing.expectEqual((try s.where("/test.txt"))[1], (try s.cursor()).?[1]); try s.write(ctl, "Collapse\n"); try std.testing.expect(std.mem.indexOf(u8, try s.read(ctl), " collapsed ") == null); diff --git a/test/behaviour/tags.zig b/test/behaviour/tags.zig index 395b63c8..35a5f882 100644 --- a/test/behaviour/tags.zig +++ b/test/behaviour/tags.zig @@ -25,7 +25,7 @@ test "tags: s and S in a tag answer for the tag's own text; / still searches the const n = try s.focused(); try s.replace(s.at("/pane/{d}/tag", .{n}), " Save Del Snarf"); // The tag's line, its S's selected, then changed: both are the tag's. - try s.keys(":xsS\ncZ\x1b"); + try s.keys("::xsS\ncZ\x1b"); try std.testing.expectEqualStrings("/test.txt Zave Del Znarf", try tag(&s, n)); try s.expect(s.at("/pane/{d}/body", .{n}), "Some body\n"); // `/` from the tag is the body's search, as acme's Look from a tag is. @@ -38,7 +38,7 @@ test "tags: ms and md edit a tag's own text, and the text the edit made is read var s = try Session.initFile(std.testing.allocator, "body\n"); defer s.deinit(); const n = try s.focused(); - try s.keys(":miwms("); + try s.keys("::miwms("); try std.testing.expectEqualStrings("/test.txt (Save) Term Collapse Follow Del", try tag(&s, n)); try s.keys("md("); try std.testing.expectEqualStrings("/test.txt Save Term Collapse Follow Del", try tag(&s, n)); @@ -50,7 +50,7 @@ test "tags: the keyboard reaches a tag's path, which it can select and yank but const n = try s.focused(); const before = try tag(&s, n); // `0` is the line's start, as in acme, where the name is ordinary text. - try s.keys(":0"); + try s.keys("::0"); try std.testing.expectEqual(@as(usize, 0), try tagCol(&s, "/test.txt")); // An edit that reaches into it is refused, the cursor with it. try s.keys("Eyd"); @@ -63,7 +63,7 @@ test "tags: the keyboard reaches a tag's path, which it can select and yank but try s.keys("\x1b\x1b"); try s.expect(s.at("/pane/{d}/name", .{n}), "/test.txt\n"); // After the path, the text is the tag's own to edit. - try s.keys(":A!\x1b"); + try s.keys("::A!\x1b"); try std.testing.expectEqualStrings("/test.txt Save Term Collapse Follow Del!", try tag(&s, n)); // What it yanked was the path. try s.keys(":P"); @@ -81,7 +81,7 @@ test "tags: a tag remembers its cursor, starts on Save, and a click moves it" { const other = s.at("{d}", .{second}); try s.write("/focus", focus); // Nothing to remember yet: `:` lands on Save. - try s.keys(":"); + try s.keys("::"); try std.testing.expectEqual(@as(usize, "/test.txt ".len), try tagCol(&s, "/test.txt")); // Home is the line's start, the path's: the keyboard reaches it. try s.keys(home ++ right ++ right ++ right); @@ -90,13 +90,13 @@ test "tags: a tag remembers its cursor, starts on Save, and a click moves it" { try s.keys(":"); try std.testing.expect((try s.cursor()).?[1] != (try s.where("/test.txt"))[1]); try s.write("/focus", other); - try s.keys(":" ++ home ++ right ++ right ++ right ++ right ++ right ++ ":"); + try s.keys("::" ++ home ++ right ++ right ++ right ++ right ++ right ++ ":"); try s.write("/focus", focus); - try s.keys(":"); + try s.keys("::"); try std.testing.expectEqual(@as(usize, 3), try tagCol(&s, "/test.txt")); try s.keys(":"); try s.write("/focus", other); - try s.keys(":"); + try s.keys("::"); try std.testing.expectEqual(@as(usize, 5), try tagCol(&s, "/second.txt")); try s.keys(":"); // A click in the tag puts its cursor there, the pane's keyboard with it. @@ -105,7 +105,7 @@ test "tags: a tag remembers its cursor, starts on Save, and a click moves it" { try std.testing.expectEqual(@as(usize, "/test.txt Save T".len), try tagCol(&s, "/test.txt")); // A prompt opened and left from the body leaves it there (a clicked // tag is in normal mode: `:` goes back to the body). - try s.keys(":/\x1b:"); + try s.keys(":/\x1b::"); try std.testing.expectEqual(@as(usize, "/test.txt Save T".len), try tagCol(&s, "/test.txt")); try s.keys(":"); try s.expect(s.at("/pane/{d}/body", .{first}), "body\n"); @@ -119,13 +119,13 @@ test "tags: executing a word from the tag runs it and gives the keyboard back to try s.keys("ix\x1b"); // `:` lands on Save; the execute key runs it, the look key looks // it up. Either way the tag lets go of the keyboard first. - try s.keys(":"); + try s.keys("::"); try s.keys(chord); try std.testing.expectEqual(@as(usize, if (chord[0] == '\t') 1 else 0), s.saved); try s.keys("iQ\x1b"); try s.expect(s.at("/pane/{d}/body", .{n}), "xQbody\n"); // ...and the tag still knows where it was. - try s.keys(":"); + try s.keys("::"); try std.testing.expectEqual(@as(usize, "/test.txt ".len), try tagCol(&s, "/test.txt")); } } @@ -134,13 +134,13 @@ test "tags: a renamed path moves the tag's cursor with the text after it and a s var s = try Session.initFile(std.testing.allocator, "body\n"); defer s.deinit(); const n = try s.focused(); - try s.keys("::"); // on Save, and back + try s.keys(":::"); // `::` on Save, and `:` back try s.write(s.at("/pane/{d}/name", .{n}), "/界.zig"); - try s.keys(":"); + try s.keys("::"); try std.testing.expectEqual(@as(usize, "/界.zig ".len - 1), try tagCol(&s, "/界")); try s.keys(":"); try s.replace(s.at("/pane/{d}/tag", .{n}), "é"); - try s.keys(":"); + try s.keys("::"); // `/界.zig é`: the cursor is pulled back onto the last character. try std.testing.expectEqual(@as(usize, "/界.zig ".len - 1), try tagCol(&s, "/界")); try s.expect(s.at("/pane/{d}/body", .{n}), "body\n"); @@ -153,13 +153,13 @@ test "tags: window keys move between panes from a tag and each tag keeps its cur const second = try s.newPane(); try s.write(s.at("/pane/{d}/name", .{second}), "/second.txt"); try s.write("/focus", s.at("{d}", .{first})); - try s.keys(":" ++ home ++ "ll" ++ window ++ "j\n"); + try s.keys("::" ++ home ++ "ll" ++ window ++ "j\n"); try std.testing.expectEqual(second, try s.focused()); - try s.keys(":" ++ home ++ "llll" ++ window ++ "k\n"); + try s.keys("::" ++ home ++ "llll" ++ window ++ "k\n"); try std.testing.expectEqual(first, try s.focused()); - try s.keys(":"); + try s.keys("::"); try std.testing.expectEqual(@as(usize, 2), try tagCol(&s, "/test.txt")); - try s.keys(window ++ "j\n:"); + try s.keys(window ++ "j\n::"); try std.testing.expectEqual(@as(usize, 4), try tagCol(&s, "/second.txt")); } @@ -170,7 +170,7 @@ test "tags: a tag's normal mode is the body's: motions stay in the tag and inser try s.write("/ctl", "Newcol\n"); const right_pane = try s.newPane(); try s.write("/focus", s.at("{d}", .{first})); - try s.keys(":" ++ home ++ "l"); + try s.keys("::" ++ home ++ "l"); try std.testing.expectEqual(@as(usize, 1), try tagCol(&s, "/test.txt")); try s.keys("hkj"); try std.testing.expectEqual(@as(usize, 0), try tagCol(&s, "/test.txt")); @@ -179,7 +179,7 @@ test "tags: a tag's normal mode is the body's: motions stay in the tag and inser try std.testing.expectEqual(right_pane, try s.focused()); try s.keys(window ++ "h\n"); try std.testing.expectEqual(first, try s.focused()); - try s.keys(":i\u{F018}hjklHJKL:"); + try s.keys("::i\u{F018}hjklHJKL:"); try std.testing.expectEqualStrings("/test.txt Save Term Collapse Follow DelhjklHJKL:", try tag(&s, first)); try std.testing.expect(std.mem.endsWith(u8, try s.read(s.at("/pane/{d}/ctl", .{first})), " mode:normal ")); try s.expect(s.at("/pane/{d}/body", .{first}), "body\n"); @@ -191,7 +191,7 @@ test "tags: a tag with a newline in it is as tall as its lines, and each line is defer s.deinit(); const n = try s.focused(); // Insert mode in a tag is a body's: Enter is a new line. - try s.keys(":A\nSecond"); + try s.keys("::A\nSecond"); try std.testing.expectEqualStrings("/test.txt Save Term Collapse Follow Del\nSecond", try tag(&s, n)); const x, const y = try s.where("/test.txt"); try std.testing.expectEqual(.{ x, y + 1 }, try s.where("Second")); @@ -220,7 +220,7 @@ test "tags: a tag with more lines than rows scrolls to keep its caret in view" { try s.write(s.at("/pane/{d}/tag", .{n}), many.items); const x, const y = try s.where("/test.txt"); // To the last line: the tag scrolls so it is the bottom row, caret on it. - try s.keys(":ge"); + try s.keys("::ge"); const lx, const ly = try s.where("L20"); try std.testing.expectEqual(.{ lx, ly }, (try s.cursor()).?); // What the pointer sees is what is shown: its first row is line 13. @@ -250,7 +250,7 @@ test "tags: a long pane tag wraps onto rows, and a click on a wrapped row maps t try s.write(s.at("/pane/{d}/name", .{n}), "/an/especially/deep/project/path/with/a/long/component/filename.zig"); try s.write(s.at("/pane/{d}/tag", .{n}), " JumpTrail"); const before = try tag(&s, n); - try s.keys(":A"); + try s.keys("::A"); try std.testing.expect((try s.cursor()).?[0] < 50); // JumpTrail is on a row of its own, below the path's. try std.testing.expect((try s.where("JumpTrail"))[1] > (try s.where("/an/"))[1]); @@ -437,7 +437,7 @@ test "tags: truncating a tag clears its own text, u in the tag undoes it, and > s.clunk(h); try std.testing.expectEqualStrings("/test.txt", std.mem.trimEnd(u8, try tag(&s, n), " ")); // The tag keeps its undo: undoing in it brings back what was cleared. - try s.keys(":u:"); + try s.keys("::u:"); try std.testing.expect(std.mem.endsWith(u8, try tag(&s, n), " Mine")); // Written back without a leading space, the text still stands apart // from the path, and a click on its first letter lands on it. |
