diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-26 11:54:48 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-26 12:15:13 -0300 |
| commit | 75534de566388fe8dcb17b8257d535c680ae4b7d (patch) | |
| tree | 6528b3315a76dc80710a8c1c0f6268cca21fa7e5 /core/Prompt.zig | |
| parent | e9991ca68067ee835af43868a193e8e6bd5dd420 (diff) | |
| download | pardes-75534de566388fe8dcb17b8257d535c680ae4b7d.tar.gz pardes-75534de566388fe8dcb17b8257d535c680ae4b7d.zip | |
Pick, Prompt, TagState, test/process: the act/source row goes, and every head row ends with its count and at most one dim hint, the one key to what the head and the band do not show; a list known at open is exactly its rows tall (UX DESIGN O4, binding; the user, on W5's field under the tag: "why so many builtins are shown below still? most of them don't make much sence in the picker context right? also why other pickers names are there? that's wayyyyy to crowded, we only want to keep the absolute necessary there"); THE WAY IT WAS: Pick.head put a second row under every picker's head, under the spines, `Walk Look Split Newcol Grep Edit Copy Keep Drop | Grep Recent Panes Symbols All Jumplist …` (the acts, then the other sources' words, cut with `…`), the head row's right block carried up to 43 cells of hints (`⏎ land · M-⏎ as a list · C-r history · esc`, `↑ roll up · ? field · esc`, `⏎ wear it · esc`, `⏎ or 1-9 apply it · esc`, `⏎ rename · esc`, `⏎ run · esc`), and Pick.bandRows held 4 rows at least (D6's 4 counted the act row), a Grep's and All's 11 from the first frame whatever they found; THE CHANGE: Pick.head is one row, the count and `M-l acts` (dim, dropped first when the row is narrow; none for Themes, code actions and Lists, which have no acts); the acts stay on their keys and in the act step (M-l, M-Enter), each source on its own leader key, M-h's spine switching with the query kept, and any word typed into a tag still runs (Pick.execWord: `Grep`, `Split`); every text prompt and `:` hints `C-r history` (Prompt's table loses its `hint` column: one const), a rolled or unrolled level and the registers `? help`, describe-key keeps its question `press a key or a sequence` (its `· esc` and a found key's `⏎ run · esc` go), rename none; Pick.bandRows: a list known at open (Panes, Recent, Jumplist, a list, Messages, Themes, code actions, Lists) exactly its rows (1 at least, 11 and the cap at most), one whose rows come later (Find, Grep, All, Symbols) 3 at least and growing as they come, never shrinking while it is up: `tall`, a picker's most rows since it unrolled (a new field, reset by unroll, raised in produceAll a step at a time: in the dump and the digest), so typing a Grep's query never moves the body; RUN (TEST FIRST): Pick "a picker's head is one row: the count and one dim hint at its right end, `M-l acts`; no row of acts and sources, the list's rows right under it; Themes hints nothing" (replaces the act-row test; fails on the change before at Pick.zig:3979, the head two rows) and Pick "a picker's band is its list's rows (UX DESIGN O4, D6): a list whose rows come later (Find) holds 3 at open, never moved by typing; a list known at open exactly its rows: SPC b b with two panes covers its head and 2 rows" (was "… 4 rows at least …"; fails on the change before, 4 rows for 3), pass now; the tests that read the old hints read the new ones (TagState's right block, at 14 columns now where `? help` no longer fits, its rolled-level and wrapping tests, Band's SPC Down, draw's dim-hint ink, Prompt's `/ ? s K |` heads, Command's `:`), Pick's 40 % test lets the Grep's lines come (the clock to the pause's end: 40 lines, the band from 3 to its cap), and views' short-column test runs at 40x14 (at 40x15 the band, a row shorter, now fits whole); a user saw the crowded row under every picker and the long hints on every head; the process cases that wait for a rolled level wait for its `? help` (tty_boot leader twice, tty_editing find; they waited for `↓ unroll`); GATES (Debug tui): core-test 1172/1346 (174 skipped; one program's 7 cached), shell-test 1387/1390 (3 skipped); process-test 7 of 149 failed (3 skipped): pipe, msg, selregex, fsearch, lsp on their goldens, leader and find on the old wait, the goldens re-recorded by the next change; the dump changes (Pick.tall, and the change before's TagState.waits): the dump fuzz and the soak with the next change; load 1.4 to 4.7
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/Prompt.zig')
| -rw-r--r-- | core/Prompt.zig | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/core/Prompt.zig b/core/Prompt.zig index e9c231da..d5f9a374 100644 --- a/core/Prompt.zig +++ b/core/Prompt.zig @@ -124,24 +124,28 @@ pub const Ring = struct { const Info = struct { /// Its key cell. cell: []const u8, - hint: []const u8, }; const info = std.EnumArray(Op, Info).init(.{ - .search = .{ .cell = "/", .hint = "⏎ land · M-⏎ as a list · C-r history · esc" }, - .search_back = .{ .cell = "?", .hint = "⏎ land · M-⏎ as a list · C-r history · esc" }, - .select = .{ .cell = "s", .hint = "⏎ select · M-⏎ as a list · C-r history · esc" }, - .split = .{ .cell = "S", .hint = "⏎ select · M-⏎ as a list · C-r history · esc" }, - .keep = .{ .cell = "K", .hint = "⏎ keep · M-⏎ as a list · C-r history · esc" }, - .remove = .{ .cell = "A-K", .hint = "⏎ keep · M-⏎ as a list · C-r history · esc" }, - .pipe = .{ .cell = "|", .hint = "⏎ replace · C-r history · esc" }, - .pipe_to = .{ .cell = "A-|", .hint = "⏎ run · C-r history · esc" }, - .insert = .{ .cell = "!", .hint = "⏎ insert · C-r history · esc" }, - .append = .{ .cell = "A-!", .hint = "⏎ append · C-r history · esc" }, - .keep_pipe = .{ .cell = "$", .hint = "⏎ keep · C-r history · esc" }, - .command = .{ .cell = ":", .hint = "Tab complete · ⏎ run · C-r history · esc" }, + .search = .{ .cell = "/" }, + .search_back = .{ .cell = "?" }, + .select = .{ .cell = "s" }, + .split = .{ .cell = "S" }, + .keep = .{ .cell = "K" }, + .remove = .{ .cell = "A-K" }, + .pipe = .{ .cell = "|" }, + .pipe_to = .{ .cell = "A-|" }, + .insert = .{ .cell = "!" }, + .append = .{ .cell = "A-!" }, + .keep_pipe = .{ .cell = "$" }, + .command = .{ .cell = ":" }, }); +/// Every prompt's one hint (UX DESIGN O4): the key to what its head and +/// band do not show. Enter's verb is the head's own `= Look /dirty/`; +/// M-Enter and Tab are in Help; Esc is never hinted. +const hint = "C-r history"; + /// The history `op` reads and Enter adds to. fn ring(p: *Pardes, op: Op) *Ring { return switch (op) { @@ -1097,7 +1101,7 @@ fn strike(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, line: i32, lo_: } /// The head of the prompt's tag: `s self▌ = Exec Edit x/self/ 4 -/// selections in 6 lines ⏎ select · M-⏎ as a list · C-r history · esc`. +/// selections in 6 lines C-r history`. pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !TagState.Head { const s = &p.view().tag_state; const pr = &s.prompt; @@ -1139,7 +1143,6 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !TagState.Head { } if (pr.op == .command) try Command.count(p, arena, text); const hints = text.items.len; - const hint = info.get(pr.op).hint; if (tail) |t| { // Both beside the count, or neither: as much room as the right // block asks for its two gaps (Builder.right drops the hints alone). @@ -1402,9 +1405,10 @@ test "s asks in the tag's head: its key cell, the field, the plain word and the try std.testing.expectEqual(TagState.Kind.prompt, p.view().tag_state.kind); // No chip on the notice band: the prompt is the tag's. try std.testing.expectEqual(Pane.Prompt.none, pane.prompt); - try std.testing.expect(has(try headOf(p), "s ⏎ select · M-⏎ as a list · C-r history · esc")); + // Its one hint at the row's end (UX DESIGN O4). + try std.testing.expect(std.mem.startsWith(u8, try headOf(p), "s ") and std.mem.endsWith(u8, try headOf(p), " C-r history")); typeKeys(p, "self"); - try std.testing.expect(has(try headOf(p), "s self = Exec Edit x/self/ 2 selections in 3 lines ⏎ select")); + try std.testing.expect(has(try headOf(p), "s self = Exec Edit x/self/ ") and has(try headOf(p), "2 selections in 3 lines C-r history")); try std.testing.expectEqual(@as(u16, 1), pane.body.nsel); try std.testing.expect(selecting(p, pane).?.dim == false); // No match: 0, and the selection it began with. @@ -1447,7 +1451,7 @@ test "Enter keeps what s found, the pattern in / and in the history Up brings ba try std.testing.expect(has(try headOf(p), "K self.. = Exec Edit g/self../ keeps 2 of 2")); p.update(.{ .key = .{ .cp = Key.down } }); typeKeys(p, "b"); - try std.testing.expect(has(try headOf(p), "K b = Exec Edit g/b/ keeps 1 of 2 ⏎ keep")); + try std.testing.expect(has(try headOf(p), "K b = Exec Edit g/b/ ") and has(try headOf(p), "keeps 1 of 2 C-r history")); // Ctrl-r: the history under the tag, a row a line. p.update(.{ .key = .{ .cp = 'r', .ctrl = true } }); try std.testing.expectEqual(@as(u16, 1), Band.takes(p, p.view().active)); @@ -1459,7 +1463,7 @@ test "Enter keeps what s found, the pattern in / and in the history Up brings ba typeKeys(p, "|"); try std.testing.expectEqual(Pane.Prompt.none, pane.prompt); p.update(.{ .key = .{ .cp = 't', .text = "tr a-z A-Z" } }); - try std.testing.expect(has(try headOf(p), "| tr a-z A-Z = Exec Edit |tr a-z A-Z ⋯ ⏎ replace")); + try std.testing.expect(has(try headOf(p), "| tr a-z A-Z = Exec Edit |tr a-z A-Z ") and has(try headOf(p), "⋯ C-r history")); p.update(.{ .key = .{ .cp = Key.enter } }); try std.testing.expectEqualStrings("tr a-z A-Z", p.registers.value('|', 0).?); var asked: ?u32 = null; @@ -1496,7 +1500,7 @@ test "/ searches the body as it is typed: the current place selected, `▸` in t pane.body.cur_row = 2; pane.body.cur_col = 6; typeKeys(p, "/dirty"); - try std.testing.expect(has(try headOf(p), "/ dirty = Look /dirty/ 3/7 · 5 lines ⏎ land · M-⏎ as a list")); + try std.testing.expect(has(try headOf(p), "/ dirty = Look /dirty/ ") and has(try headOf(p), "3/7 · 5 lines C-r history")); try std.testing.expectEqual(@as(?usize, 2), pane.places.current); // (Its first row under the head's, UX DESIGN M2.) try std.testing.expectEqualStrings(" ", try gutterAt(p, frame.allocator(), 1)); @@ -1554,9 +1558,9 @@ test "? searches back from the caret; no match is 0; a pattern that is no regex pane.body.cur_col = 6; const was = pane.body.primaryRange(pane.file.?.content, 0); typeKeys(p, "?dirty"); - try std.testing.expect(has(try headOf(p), "? dirty = Look ?dirty? 2/7 · 5 lines ⏎ land")); + try std.testing.expect(has(try headOf(p), "? dirty = Look ?dirty? ") and has(try headOf(p), "2/7 · 5 lines C-r history")); typeKeys(p, "x"); - try std.testing.expect(has(try headOf(p), "= Look ?dirtyx? 0 ⏎ land")); + try std.testing.expect(has(try headOf(p), "= Look ?dirtyx? ") and has(try headOf(p), "0 C-r history")); try std.testing.expectEqualDeep(was, pane.body.primaryRange(pane.file.?.content, 0)); p.update(.{ .key = .{ .cp = Key.backspace } }); typeKeys(p, "("); @@ -1643,13 +1647,13 @@ test "a pipe prompt runs a known filter live, a run a selection: the outputs gho p.update(.{ .key = .{ .cp = Key.enter } }); typeKeys(p, "|"); p.update(.{ .key = .{ .cp = 't', .text = "tr a-z A-Z" } }); - try std.testing.expect(has(try headOf(p), "| tr a-z A-Z = Exec Edit |tr a-z A-Z ⋯ ⏎ replace")); + try std.testing.expect(has(try headOf(p), "| tr a-z A-Z = Exec Edit |tr a-z A-Z ") and has(try headOf(p), "⋯ C-r history")); const first = lastPipe(p) orelse return error.MissingLiveRun; const asked = p.pipe.pipeRequest(first).?; try std.testing.expectEqual(@as(usize, 2), asked.inputs.len); try std.testing.expect(has(asked.command, "tr a-z A-Z") and has(asked.command, "\\036")); p.update(.{ .pipe_resp = .{ .id = first, .success = true, .outputs = &.{ "B\x1e\x1e0", "A\x1e\x1e0" } } }); - try std.testing.expect(has(try headOf(p), " 2 lines → 2 · exit 0 ⏎ replace")); + try std.testing.expect(has(try headOf(p), "2 lines → 2 · exit 0 C-r history")); // The body: each output a ghost line under the line it replaces, the // rows below pushed down; the text as it was; its first row under the // head's (UX DESIGN M2). @@ -1791,7 +1795,7 @@ test "a search's count keeps ` · N lines` after it in the dim ink, and drops it const h = try head(p, p.scratch.allocator(), pane); const lines = std.mem.indexOf(u8, h.text, " \u{b7} 5 lines"); if (cols == 200) { - try std.testing.expect(has(h.text, "3/7 \u{b7} 5 lines \u{23ce} land")); + try std.testing.expect(has(h.text, "3/7 \u{b7} 5 lines C-r history")); const dim = for (h.spans) |span| { if (span.lo == lines.? and span.style == .dim) break span; } else return error.TestUnexpectedResult; @@ -1799,7 +1803,7 @@ test "a search's count keeps ` · N lines` after it in the dim ink, and drops it } else { // No room for the hints: the count alone, at the row's end. try std.testing.expect(lines == null); - try std.testing.expect(std.mem.indexOf(u8, h.text, "\u{23ce} land") == null); + try std.testing.expect(std.mem.indexOf(u8, h.text, "C-r history") == null); try std.testing.expect(std.mem.endsWith(u8, h.text, "3/7")); } } @@ -1810,7 +1814,7 @@ test "a search's count keeps ` · N lines` after it in the dim ink, and drops it pane.body.cur_row = 7; pane.body.cur_col = 6; typeKeys(p, "/dirty"); - try std.testing.expect(has(try headOf(p), "1/7 \u{21bb} \u{b7} 5 lines \u{23ce} land")); + try std.testing.expect(has(try headOf(p), "1/7 \u{21bb} \u{b7} 5 lines C-r history")); } test "C-r's history has the band's cursor like any list (UX D5): `▶` on its newest line, Down and C-n, Up and C-p move it, Enter takes the line under it" { |
