From 920aaa6e6c2317aa775937b01f727fa9418b7db2 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 25 Nov 2026 04:58:53 -0300 Subject: tagline, Trail, Core, layout: the tag out of rest is the owner's word, the newest step's and the head, nothing else (walk UI polish P1, UX DESIGN.md D1, the coordinator's R1-CORRECTED: the user's "why the tagline is still showing the regular tagline text?"): out of rest the path, Keep, the forward steps, the progress and the tag's own words were drawn before the head, so the key cells and the band's spines hung 40-50 columns in (shot 02's spines at column 50) and a picker's tag named the PREVIEWED file as the pane's own (shot 04: `/tmp/.../core/Store.zig ␣ f Find re 2/3`); now `‹@p1 › rank.zig:20 › ␣ ▸ b buffer…`, the head from the tag's first text column when there is no walk (`␣ f Find re`), the spines at columns 2-4; THE CHANGE: Trail.Part `.newest` writes the owner's word and the newest back step's alone, each with ` › `, a word past 24 cells cut in its middle with `…` (D1 item 4), and `stepAt(.newest)` maps a Look or Exec on any of its cells to that step; tagline.pathPrefix returns it while Trail.outOfRest (the live view's host is the pane: asking is rest and keeps its path), the old body now `restPath`; `restPrefix`, the prefix as at rest whatever the state, is what Core.sync measures `tag_lead` by (the tag's cursor and selections are offsets in its text at rest: a head over its own text moves none of them; on the shown prefix they were shifted by the path's length and back, and `| in a tag pipes the tag's own text` piped 4 wrong bytes) and what layout.wantedTagRows counts the rest rows with (a tag out of rest keeps them at least); the heads no longer lead with a space (TagState's Help/Keys/Rename/level, Pick.head, Prompt.head: the out-of-rest prefix ends in its own ` › `); no name tint, forward-step ink, unlit search word or progress out of rest (draw.zig tagTintRange, paintPaneTag; Prompt.unlit); tagline.onName and forwardSpan are off out of rest; `Trail.folded` is gone (it only told out of rest, now `.newest`: at rest it is `shown_steps`), `nameAt` takes no Pardes; TEST FIRST: Trail.zig "Enter on a word of the walk ...": out of rest `‹@pN › rank.zig:20 › ␣ ▸ ` with no older step, no directory, no Keep (on the base `‹@pN › · › rank.zig:20 › /rank.zig`: fails), a step back hides its forward step out of rest, Look maps the newest word and the owner's to their steps, and the tag at rest byte-identical after Esc; Pick.zig's reader test: the picker's head starts the tag's text (`␣ f Find pick 1/1`), no previewed path; the heads' other tests drop their leading space; test/behaviour keys.zig's prompt case reads the tag file out of rest as the head alone (`s zq`, no `/test.txt`); behaviour-test 277/277; core-test 1062/1232 (170 skipped); process-test: 8 goldens regenerated and read, each changed row the out-of-rest tag with no path (leader, pipe, msg, selregex, find, fsearch, lsp, ttyhelp: the band's spines at columns 2-4, the steps right of them, the rows no longer pushed onto a second tag row; msg's `s EXT` head and fsearch's `/` head still wrap their hints mid-word: D3's); a user meets it in every state out of rest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE --- core/Pick.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'core/Pick.zig') diff --git a/core/Pick.zig b/core/Pick.zig index 3bab0970..f4e26527 100644 --- a/core/Pick.zig +++ b/core/Pick.zig @@ -566,7 +566,6 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?TagState.Head { const s = &p.view().tag_state; var text: std.ArrayList(u8) = .empty; var spans: std.ArrayList(TagState.Span) = .empty; - try text.append(arena, ' '); var cells: [4][2]u32 = undefined; var ncells: usize = 0; // SPC's cell, then its keys': `␣ f`. @@ -1528,7 +1527,9 @@ test "a picker from a held pane unrolls in a reader made for it: its rows in the defer frame.deinit(); const a = frame.allocator(); const tag = try tagOf(p, a, reader); - try std.testing.expect(std.mem.indexOf(u8, tag, " ␣ f Find pick 1/1\n") != null); + // Out of rest no path (UX D1): not the previewed file's, not Keep; + // the head starts the tag's text. + try std.testing.expect(std.mem.startsWith(u8, tag, "␣ f Find pick 1/1\n")); try std.testing.expect(std.mem.indexOf(u8, tag, "│ Walk Look Split Newcol Grep Edit Copy Keep Drop | Grep Recent Panes Symbols All Jumplist") != null); // The body previews the row's file, after a frame of its own. p.update(.tick); -- cgit v1.3 From 304ea98913c178de9645cad5c3fe45a5f13e25d5 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 25 Nov 2026 05:07:21 -0300 Subject: draw: no pane dims while a tag is out of rest (walk UI polish P1, UX DESIGN.md D9): the other panes' every cell took `style.dim` while any tag was out of rest (SPEC §3.6's "slightly", built as the faint attribute: fg 12.5:1 to 4.5:1, comments 4.06:1 to 1.96:1 on neonotte84, UX A7), stacked on the user's own InactiveDim, flashed the whole screen at every SPC and repainted every pane per state change; now a tag out of rest changes its own pane and the notice row only, the others keep their look at rest (InactiveDim already applied to unfocused panes); THE CHANGE: render's pass over the other panes' cells and layers is deleted; TagState.previewing keeps its `.full` (the whole window wearing a theme, taken off at rest) and its doc says so: no pane's own bit is read any more, so Pick.unroll no longer sets the landing pane's (the field keeps its type: the wire and the dumps unchanged); TEST FIRST: Band.zig "a pane whose body would drop below four rows ... borrows them": the other pane's tag and body cells are not dim out of rest (on the base: dim, fails); core-test 1062/1232 (170 skipped); process-test: fsearch's golden regenerated and read: its `typing` style snap's left pane (the terminal) loses the `,f` (faint) on every cell, nothing else; a user saw it at every SPC, picker and prompt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE --- core/Band.zig | 5 ++-- core/Pick.zig | 3 +-- core/TagState.zig | 6 ++--- core/draw.zig | 13 ---------- test/snapshots/fsearch.golden | 56 +++++++++++++++++++++---------------------- 5 files changed, 35 insertions(+), 48 deletions(-) (limited to 'core/Pick.zig') diff --git a/core/Band.zig b/core/Band.zig index 2fcf4a3b..31205d87 100644 --- a/core/Band.zig +++ b/core/Band.zig @@ -595,12 +595,13 @@ test "a pane whose body would drop below four rows under its band borrows them f const r = p.view().rects[low]; try std.testing.expect(r.h > before); try std.testing.expect(r.h -| pane.tag_rows >= 4); - // The other panes dim; the one out of rest does not. + // No pane dims out of rest (UX D9): the others look as at rest. var frame = std.heap.ArenaAllocator.init(std.testing.allocator); defer frame.deinit(); const s = try p.render(frame.allocator()); const other = p.view().rects[top]; - try std.testing.expect(s.at(other.x + 3, other.y).style.dim); + try std.testing.expect(!s.at(other.x + 3, other.y).style.dim); + try std.testing.expect(!s.at(other.x + 3, other.y + 1).style.dim); try std.testing.expect(!s.at(r.x + 3, r.y).style.dim); p.update(.{ .key = .{ .cp = Key.escape } }); try std.testing.expectEqual(before, p.view().rects[low].h); diff --git a/core/Pick.zig b/core/Pick.zig index f4e26527..321b16b7 100644 --- a/core/Pick.zig +++ b/core/Pick.zig @@ -260,10 +260,9 @@ fn unroll(p: *Pardes, pk: *Pick, query: []const u8) void { s.rows = .{ .at = @intCast(@min(pk.at, std.math.maxInt(u16))) }; pk.unrolled = true; pk.shown = no_row; - // The whole window previews a theme: no pane dimmed (SPEC §3.6). + // The whole window previews a theme. if (pk.source == .themes) s.previewing = .full; if (p.paneBySerial(pk.landing)) |id| { - s.previewing.set(id); const pane = p.panes[id].?; pk.aside_row = pane.body.cur_row; pk.aside_col = pane.body.cur_col; diff --git a/core/TagState.zig b/core/TagState.zig index 938a45d1..8bead506 100644 --- a/core/TagState.zig +++ b/core/TagState.zig @@ -79,9 +79,9 @@ miss: u8 = 0, /// The leaf each group ran last, by its key (bindings.groups): the cursor /// starts there and the rolled level underlines it (SPEC §4.3). used: [bindings.ngroups]u8 = @splat(0), -/// The panes showing a preview of what the state would do (a picker's -/// landing pane, a pane an action draws ghosts in), by slot: not dimmed -/// while the others are (SPEC §3.6). Set by the state that previews. +/// `.full` while the whole window previews a theme (a themes picker's +/// row, `:theme `'s): its own again at rest. No pane dims out of rest +/// (UX D9), so no pane's own bit is read. previewing: std.StaticBitSet(pardes.MAX_PANES) = .empty, /// describe-key (SPEC §4.5), in the tag of pane `id`: the next keys are diff --git a/core/draw.zig b/core/draw.zig index 179b7cfc..17ac7514 100644 --- a/core/draw.zig +++ b/core/draw.zig @@ -361,19 +361,6 @@ pub fn render(p: *Pardes, arena: std.mem.Allocator) !*Surface { for (s.regionList()) |region| { if (region.kind == .notice) try joinNotice(p, s, arena, region); } - // A tag out of rest: the other panes dim a little so the eye goes to - // it, but a pane showing a preview (walk UI SPEC §3.6). - if (TagState.hostOf(p)) |host| for (p.panes, 0..) |slot, id| { - if (slot == null or id == host or v.tag_state.previewing.isSet(id)) continue; - const r = v.rects[id]; - for (r.y..r.y + r.h) |y| for (r.x..r.x + r.w) |x| { - s.at(@intCast(x), @intCast(y)).style.dim = true; - }; - for ([_]*pardes.Layer{ &s.body_layers[id], &s.tag_layers[id] }) |layer| for (layer.cells[0 .. @as(usize, layer.cols) * layer.rows]) |*cell| { - cell.style.dim = true; - }; - }; - try paintHeaders(p, s); try paintNoticeRow(p, s); diff --git a/test/snapshots/fsearch.golden b/test/snapshots/fsearch.golden index 450ea298..bf8957df 100644 --- a/test/snapshots/fsearch.golden +++ b/test/snapshots/fsearch.golden @@ -50,34 +50,34 @@ == style typing grid=180x31 |0: 0-1 d,#1d2824, 2-179 #b2c3b8,#1d2824, |1: 0-1 d,#887455, 2-89 #b2c3b8,#1d2824, 90-91 #b2c3b8,#887455, 92-179 #becfc4,#314738, -|2: 0-1 d,#496656,f 2-30 #b2c3b8,#1d2824,f 31-40 #d3b0d9,#1d2824,f 41-89 #b2c3b8,#1d2824,f 90-91 #b2c3b8,#496656,f 92-120 #b2c3b8,#1d2824,f 121-130 #d3b0d9,#1d2824,f 131-179 #b2c3b8,#1d2824,f -|3: 0-0 d,#608269,f 1-1 d,#0d1410,f 2-89 #e5eee5,#0d1410,f 90-90 #e5eee5,#608269,f 91-179 #e5eee5,#0d1410,f -|4: 0-0 d,#608269,f 1-1 d,#0d1410,f 2-89 #e5eee5,#0d1410,f 90-90 #e5eee5,#608269,f 91-179 #e5eee5,#0d1410,f -|5: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269,f 91-179 d,#0d1410,f -|6: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269,f 91-179 d,#0d1410,f -|7: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269,f 91-179 d,#0d1410,f -|8: 0-0 d,#608269,f 1-3 d,#0d1410,f 4-89 #e5eee5,#0d1410,f 90-90 #e5eee5,#608269,f 91-179 #e5eee5,#0d1410,f -|9: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269,f 91-179 d,#0d1410,f -|10: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269,f 91-179 d,#0d1410,f -|11: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269,f 91-179 d,#0d1410,f -|12: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269,f 91-179 d,#0d1410,f -|13: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269,f 91-179 d,#0d1410,f -|14: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269,f 91-179 d,#0d1410,f -|15: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269,f 91-179 d,#0d1410,f -|16: 0-1 d,#496656,f 2-30 #b2c3b8,#1d2824,f 31-40 #d3b0d9,#1d2824,f 41-89 #b2c3b8,#1d2824,f 90-91 #000000,#add38a, 92-98 #becfc4,#2c2819, 99-99 #add38a,#2c2819,b 100-100 #add38a,#2c2819, 101-104 #becfc4,#2c2819, 105-112 #becfc4,#2c2819,f 113-138 #becfc4,#2c2819, 139-179 #becfc4,#2c2819,f -|17: 0-0 d,#608269,f 1-1 d,#0d1410,f 2-89 #e5eee5,#0d1410,f 90-91 #e5eee5,#2c2819, 92-92 #becfc4,#2c2819,f 93-179 #becfc4,#2c2819, -|18: 0-0 d,#608269,f 1-1 d,#0d1410,f 2-89 #e5eee5,#0d1410,f 90-90 #e5eee5,#e5eee5, 91-94 #e5eee5,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, -|19: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269, 91-91 d,#0d1410, 92-94 d,#0d1410,b 95-95 #616f64,#0d1410,b 96-96 #add38a,#0d1410,b 97-100 #f5f7ee,#3c614a, 101-101 #f5f7ee,#0d1410, 102-179 #e5eee5,#0d1410, -|20: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, -|21: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, -|22: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#5e4923, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, -|23: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269, 91-94 d,#0d1410, 95-95 #59675c,#0d1410, 96-96 #add38a,#0d1410, 97-100 #e5eee5,#352e19, 101-179 #e5eee5,#0d1410, -|24: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, -|25: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, -|26: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, -|27: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#5e4923, 91-93 d,#0d1410, 94-95 #59675c,#0d1410, 96-96 #add38a,#0d1410, 97-100 #e5eee5,#352e19, 101-179 #e5eee5,#0d1410, -|28: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269, 91-93 d,#0d1410, 94-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, -|29: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269, 91-93 d,#0d1410, 94-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, +|2: 0-1 d,#496656, 2-30 #b2c3b8,#1d2824, 31-40 #d3b0d9,#1d2824, 41-89 #b2c3b8,#1d2824, 90-91 #b2c3b8,#496656, 92-120 #b2c3b8,#1d2824, 121-130 #d3b0d9,#1d2824, 131-179 #b2c3b8,#1d2824, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 #e5eee5,#608269, 91-179 #e5eee5,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 #e5eee5,#608269, 91-179 #e5eee5,#0d1410, +|5: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-179 d,#0d1410, +|6: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-179 d,#0d1410, +|7: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-179 d,#0d1410, +|8: 0-0 d,#608269, 1-3 d,#0d1410, 4-89 #e5eee5,#0d1410, 90-90 #e5eee5,#608269, 91-179 #e5eee5,#0d1410, +|9: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-179 d,#0d1410, +|10: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-179 d,#0d1410, +|11: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-179 d,#0d1410, +|12: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-179 d,#0d1410, +|13: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-179 d,#0d1410, +|14: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-179 d,#0d1410, +|15: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-179 d,#0d1410, +|16: 0-1 d,#496656, 2-30 #b2c3b8,#1d2824, 31-40 #d3b0d9,#1d2824, 41-89 #b2c3b8,#1d2824, 90-91 #000000,#add38a, 92-98 #becfc4,#2c2819, 99-99 #add38a,#2c2819,b 100-100 #add38a,#2c2819, 101-104 #becfc4,#2c2819, 105-112 #becfc4,#2c2819,f 113-138 #becfc4,#2c2819, 139-179 #becfc4,#2c2819,f +|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-91 #e5eee5,#2c2819, 92-92 #becfc4,#2c2819,f 93-179 #becfc4,#2c2819, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 #e5eee5,#e5eee5, 91-94 #e5eee5,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, +|19: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-94 d,#0d1410,b 95-95 #616f64,#0d1410,b 96-96 #add38a,#0d1410,b 97-100 #f5f7ee,#3c614a, 101-101 #f5f7ee,#0d1410, 102-179 #e5eee5,#0d1410, +|20: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, +|21: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#5e4923, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, +|23: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-94 d,#0d1410, 95-95 #59675c,#0d1410, 96-96 #add38a,#0d1410, 97-100 #e5eee5,#352e19, 101-179 #e5eee5,#0d1410, +|24: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, +|25: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, +|26: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, +|27: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#5e4923, 91-93 d,#0d1410, 94-95 #59675c,#0d1410, 96-96 #add38a,#0d1410, 97-100 #e5eee5,#352e19, 101-179 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-93 d,#0d1410, 94-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-93 d,#0d1410, 94-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, |30: 0-1 d,#1d2824, 2-179 #67756e,#1d2824, == snap list grid=180x31 cursor=110,16 |16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › ␣ l /MARK/ 1/3 -- cgit v1.3 From 99c70953a0c3b8e32cc5b61121c2b18e5ee68edd Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 25 Nov 2026 05:39:53 -0300 Subject: TagState, Pick, Prompt: the head's right block, the count `cursor/matches` and the hints at its row's right end, fixed while the field grows, the hints dim and first to go (walk UI polish P1, UX DESIGN.md D3): the count sat three spaces after the field (`Help tut▌ 3/133`, `Find re▌ 2/3`), so it slid right with every key typed, the only moving thing in the tag, and meant two things (Help's matches/total, the picker's cursor/matches); the hints followed it and wrapped mid-word onto a row of their own (msg's `s EXT ... C-r histo` / `ry · esc`); now `TagState.Builder.right(count, hints)` moves what was put from those bytes on to the row's right end (its last cell the row's last, two blanks between, at least two before), drops the hints whole when the row has no room for them, never the count (a head with no room for it runs past its row: the field's scroll D3 asks for there is not built); THE CHANGE: Builder is pub, made by `Builder.of(p, arena, pane)` with the row's width and the prefix's cells before the head (`col`), and Pick.head and Prompt.head build in it (their text and spans the builder's); counts: Help's is the cursor's row of its hits (`2/17`, `0` with none: no total), the picker's `0` with none (was `0/0`), the search prompt's wrap ` ↻` (was ` · wrapped`); hints are dim spans (describe-key's `⏎ run · esc`, Rename's, unrolled's `↑ roll up · ? field · esc`, the prompts' and the themes picker's); the rolled level keeps its hint as before (D2's rows put it on its last row); TEST FIRST: TagState.zig "the right block: the count `cursor/matches` at the row's right end, fixed while the field grows; the hints after it, dim, dropped whole where the row has no room" (Help at 60 columns: the first row exactly the tag's width ending ` 1/N`, the same after typing and `2/N` after Down; unrolled SPC's hints at the end, a dim span; at 24 columns `␣ SPC` alone); the tests reading heads read a run of blanks as two (Prompt.zig, Command.zig `has`; Pick, Band: the first row's start and end); core-test 1063/1233 (170 skipped); process-test: 7 goldens regenerated and read (find, fsearch, lsp, msg, pipe, selregex, ttyhelp): every changed row a count or hints moved to the row's right end (`␣ f Find zqm` ... `1/3`), `0/0` now `0`, ttyhelp's `1/136` now `1/1` (one match, the cursor on it), msg's `s EXT` hints dropped at 70 columns so its tag is one row again (the body a row up, where it is at rest); a user saw the count move at every key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE --- core/Band.zig | 3 +- core/Command.zig | 16 +++- core/Pick.zig | 24 ++++-- core/Prompt.zig | 46 ++++++++--- core/TagState.zig | 174 ++++++++++++++++++++++++++++++++++++++--- test/snapshots/find.golden | 10 +-- test/snapshots/fsearch.golden | 46 +++++------ test/snapshots/lsp.golden | 6 +- test/snapshots/msg.golden | 10 +-- test/snapshots/pipe.golden | 2 +- test/snapshots/selregex.golden | 10 +-- test/snapshots/ttyhelp.golden | 2 +- 12 files changed, 263 insertions(+), 86 deletions(-) (limited to 'core/Pick.zig') diff --git a/core/Band.zig b/core/Band.zig index 31205d87..024b6be4 100644 --- a/core/Band.zig +++ b/core/Band.zig @@ -555,7 +555,8 @@ test "SPC Down unrolls the level into a band under the tag's text, the body push for (s.cells[@as(usize, layer.viewport.y) * s.cols ..][layer.viewport.x..][0..layer.viewport.w]) |cell| try grid.appendSlice(frame.allocator(), cell.grapheme()); try std.testing.expect(std.mem.indexOf(u8, grid.items, "▶ b buffer…") != null); // The head names the level and says how to roll it up. - try std.testing.expect(std.mem.endsWith(u8, try tagline.tagText(p, frame.allocator(), pane), "␣ SPC ↑ roll up · ? field · esc")); + const head = try tagline.tagText(p, frame.allocator(), pane); + try std.testing.expect(std.mem.startsWith(u8, head, "␣ SPC ") and std.mem.endsWith(u8, head, " ↑ roll up · ? field · esc")); // Down moves the cursor; Up back to the first row, then rolls up. p.update(.{ .key = .{ .cp = Key.down } }); try std.testing.expectEqual(@as(u8, 'c'), p.view().tag_state.hi); diff --git a/core/Command.zig b/core/Command.zig index 334d49a2..908358de 100644 --- a/core/Command.zig +++ b/core/Command.zig @@ -659,8 +659,22 @@ fn tagOf(p: *Pardes) ![]const u8 { return tagline.tagText(p, p.scratch.allocator(), p.panes[p.view().active].?); } +/// Whether `needle` is in `hay`, a run of two spaces or more in either read +/// as two: a right block's padding is its row's (UX D3). fn has(hay: []const u8, needle: []const u8) bool { - return std.mem.indexOf(u8, hay, needle) != null; + var in: [8192]u8 = undefined; + var of: [1024]u8 = undefined; + return std.mem.indexOf(u8, squeezed(hay, &in), squeezed(needle, &of)) != null; +} + +fn squeezed(s: []const u8, buf: []u8) []const u8 { + var n: usize = 0; + for (s, 0..) |c, i| { + if (c == ' ' and i >= 2 and s[i - 1] == ' ' and s[i - 2] == ' ') continue; + buf[n] = c; + n += 1; + } + return buf[0..n]; } /// Band row `y`'s text under the live view's active pane. diff --git a/core/Pick.zig b/core/Pick.zig index 321b16b7..8fcc5945 100644 --- a/core/Pick.zig +++ b/core/Pick.zig @@ -563,8 +563,9 @@ fn rowAt(p: *Pardes, pk: *const Pick, arena: std.mem.Allocator, i: usize) !Row { pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?TagState.Head { const pk = live(p) orelse return null; const s = &p.view().tag_state; - var text: std.ArrayList(u8) = .empty; - var spans: std.ArrayList(TagState.Span) = .empty; + var b = try TagState.Builder.of(p, arena, pane); + const text = &b.text; + const spans = &b.spans; var cells: [4][2]u32 = undefined; var ncells: usize = 0; // SPC's cell, then its keys': `␣ f`. @@ -581,16 +582,22 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?TagState.Head { if (pk.spine == .edit) try text.print(arena, "{s} | Edit ", .{pk.query.slice()}); const caret: u32 = @intCast(text.items.len + s.field.caret); try text.appendSlice(arena, s.field.text()); + // The count at the row's right end (UX D3): `cursor/matches`, `0` with + // none, ` •M` marked. + const counted = text.items.len; const n = count(p, pk); - try text.print(arena, " {d}/{d}", .{ if (n == 0) 0 else s.rows.at + 1, n }); + if (n == 0) try text.append(arena, '0') else try text.print(arena, "{d}/{d}", .{ s.rows.at + 1, n }); if (pk.marks.items.len > 0) try text.print(arena, " •{d}", .{pk.marks.items.len}); if (pk.names.busy() or p.stream.busyFor(pk.id)) try text.appendSlice(arena, " ⋯"); // Themes have no acts and no other sources: no second row. if (pk.source == .themes) { - try text.appendSlice(arena, " ⏎ wear it · esc"); + const hints = text.items.len; + try b.styled("⏎ wear it · esc", .dim); + try b.right(counted, hints); for (cells[0..ncells]) |c| try spans.append(arena, .{ .lo = c[0], .hi = c[1], .style = .key }); return .{ .text = text.items, .spans = spans.items, .cells = @intCast(ncells), .caret = caret }; } + try b.right(counted, text.items.len); // The second row: the spines go on through it from the key cells, // then the other sources' words, each switching to it. try text.append(arena, '\n'); @@ -1528,7 +1535,8 @@ test "a picker from a held pane unrolls in a reader made for it: its rows in the const tag = try tagOf(p, a, reader); // Out of rest no path (UX D1): not the previewed file's, not Keep; // the head starts the tag's text. - try std.testing.expect(std.mem.startsWith(u8, tag, "␣ f Find pick 1/1\n")); + const first = tag[0..std.mem.indexOfScalar(u8, tag, '\n').?]; + try std.testing.expect(std.mem.startsWith(u8, first, "␣ f Find pick ") and std.mem.endsWith(u8, first, " 1/1")); try std.testing.expect(std.mem.indexOf(u8, tag, "│ Walk Look Split Newcol Grep Edit Copy Keep Drop | Grep Recent Panes Symbols All Jumplist") != null); // The body previews the row's file, after a frame of its own. p.update(.tick); @@ -1570,7 +1578,8 @@ test "a picker's keys: Tab marks and moves, M-a all and none, C-SPC refines and try std.testing.expectEqual(@as(u16, 2), s.rows.at); var frame = std.heap.ArenaAllocator.init(std.testing.allocator); defer frame.deinit(); - try std.testing.expect(std.mem.indexOf(u8, try tagOf(p, frame.allocator(), id), " Refs 3/4 •1\n") != null); + const refs = try tagOf(p, frame.allocator(), id); + try std.testing.expect(std.mem.indexOf(u8, refs, " Refs ") != null and std.mem.indexOf(u8, refs, " 3/4 •1\n") != null); p.update(.{ .key = .{ .cp = 'a', .alt = true } }); try std.testing.expectEqual(@as(usize, 4), pk.marks.items.len); p.update(.{ .key = .{ .cp = 'a', .alt = true } }); @@ -1588,7 +1597,8 @@ test "a picker's keys: Tab marks and moves, M-a all and none, C-SPC refines and settle(p); try std.testing.expectEqual(@as(usize, 1), count(p, pk)); _ = frame.reset(.retain_capacity); - try std.testing.expect(std.mem.indexOf(u8, try tagOf(p, frame.allocator(), id), " Refs alpha | w 1/1\n") != null); + const refined = try tagOf(p, frame.allocator(), id); + try std.testing.expect(std.mem.indexOf(u8, refined, " Refs alpha | w ") != null and std.mem.indexOf(u8, refined, " 1/1\n") != null); // Backspace twice: the `w` goes, then the refinement, its query back. p.update(.{ .key = .{ .cp = Key.backspace } }); p.update(.{ .key = .{ .cp = Key.backspace } }); diff --git a/core/Prompt.zig b/core/Prompt.zig index 10886606..27b59649 100644 --- a/core/Prompt.zig +++ b/core/Prompt.zig @@ -1062,9 +1062,10 @@ fn strike(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, line: i32, lo_: pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !TagState.Head { const s = &p.view().tag_state; const pr = &s.prompt; - var text: std.ArrayList(u8) = .empty; - var spans: std.ArrayList(TagState.Span) = .empty; - try styled(arena, &text, &spans, info.get(pr.op).cell, .key); + var b = try TagState.Builder.of(p, arena, pane); + const text = &b.text; + const spans = &b.spans; + try styled(arena, text, spans, info.get(pr.op).cell, .key); try text.append(arena, ' '); const caret: u32 = @intCast(text.items.len + s.field.caret); const line = s.field.text(); @@ -1074,20 +1075,25 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !TagState.Head { var w: std.Io.Writer = .fixed(&buf); const said = if (pr.op == .command) Command.plainWord(p, &w, line) else plainWord(&w, pr.op, line) catch null; if (said) |verb| { - try styled(arena, &text, &spans, try std.fmt.allocPrint(arena, " = {s}", .{verb}), .dim); + try styled(arena, text, spans, try std.fmt.allocPrint(arena, " = {s}", .{verb}), .dim); try text.print(arena, " {s}", .{w.buffered()}); } + } + // The count and the hints at the row's right end (UX D3). + const at = text.items.len; + if (line.len > 0) { if (pr.bad) { try text.appendSlice(arena, " "); - try styled(arena, &text, &spans, regexMessage(line), .err); + try styled(arena, text, spans, regexMessage(line), .err); try text.print(arena, " · the {d} from before shown, dimmed", .{@as(usize, pane.body.nsel) + 1}); } else if (behavior(pr.op) != null) { - try pipeCount(p, arena, &text, &spans, pane, pr, line); - } else try count(arena, &text, pane, pr); + try pipeCount(p, arena, text, spans, pane, pr, line); + } else try count(arena, text, pane, pr); } - if (pr.op == .command) try Command.count(p, arena, &text); - try text.appendSlice(arena, " "); - try styled(arena, &text, &spans, info.get(pr.op).hint, .dim); + if (pr.op == .command) try Command.count(p, arena, text); + const hints = text.items.len; + try styled(arena, text, spans, info.get(pr.op).hint, .dim); + try b.right(at, hints); return .{ .text = text.items, .spans = spans.items, .cells = 1, .caret = caret }; } @@ -1115,7 +1121,7 @@ fn count(arena: std.mem.Allocator, text: *std.ArrayList(u8), pane: *Pane, pr: *c // Round the end from where it began. const c = at orelse return; const origin = set.origin(pane); - if (if (pr.op == .search) hits[c].start < origin else hits[c].start > origin) try text.appendSlice(arena, " · wrapped"); + if (if (pr.op == .search) hits[c].start < origin else hits[c].start > origin) try text.appendSlice(arena, " ↻"); }, .select, .split => if (pr.found == 0) try text.appendSlice(arena, " 0") @@ -1255,8 +1261,22 @@ fn tagOf(p: *Pardes) ![]const u8 { return tagline.tagText(p, p.scratch.allocator(), p.panes[p.view().active].?); } +/// Whether `needle` is in `hay`, a run of two spaces or more in either read +/// as two: a right block's padding is its row's (UX D3). fn has(hay: []const u8, needle: []const u8) bool { - return std.mem.indexOf(u8, hay, needle) != null; + var in: [8192]u8 = undefined; + var of: [1024]u8 = undefined; + return std.mem.indexOf(u8, squeezed(hay, &in), squeezed(needle, &of)) != null; +} + +fn squeezed(s: []const u8, buf: []u8) []const u8 { + var n: usize = 0; + for (s, 0..) |c, i| { + if (c == ' ' and i >= 2 and s[i - 1] == ' ' and s[i - 2] == ' ') continue; + buf[n] = c; + n += 1; + } + return buf[0..n]; } test "s asks in the tag's head: its key cell, the field, the plain word and the count, the selections live in the body; no match is 0, a pattern that is no regex keeps the last result dimmed and says why, Esc puts them back" { @@ -1269,7 +1289,7 @@ 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(std.mem.endsWith(u8, try tagOf(p), "s ⏎ select · M-⏎ as a list · C-r history · esc")); + try std.testing.expect(has(try tagOf(p), "s ⏎ select · M-⏎ as a list · C-r history · esc")); typeKeys(p, "self"); try std.testing.expect(has(try tagOf(p), "s self = Exec Edit x/self/ 2 selections in 3 lines ⏎ select")); try std.testing.expectEqual(@as(u16, 1), pane.body.nsel); diff --git a/core/TagState.zig b/core/TagState.zig index 96c5b9b1..d70edf47 100644 --- a/core/TagState.zig +++ b/core/TagState.zig @@ -466,22 +466,106 @@ pub const Head = struct { caret: ?u32 = null, }; -const Builder = struct { +/// A head as it is built: its text and spans, laid out against the tag's +/// rows (UX D2, D3). +pub const Builder = struct { arena: std.mem.Allocator, text: std.ArrayList(u8) = .empty, spans: std.ArrayList(Span) = .empty, cells: u8 = 0, + /// The cells of a row of the tag, and those before the head on its + /// first row (the owner's and the newest step's words). + width: usize = 0, + lead: usize = 0, + tab: u16 = 8, - fn put(b: *Builder, s: []const u8) !void { + /// A head for pane `pane`'s tag, out of rest in the live view. + pub fn of(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !Builder { + const prefix = try tagline.prefixIn(p, arena, pane); + const id = panes.paneIdOf(p, pane) orelse 0; + return .{ .arena = arena, .width = tagline.tagWidth(p, id), .lead = panes.File.displayWidth(p.settings.tab, prefix), .tab = p.settings.tab }; + } + + pub fn put(b: *Builder, s: []const u8) !void { try b.text.appendSlice(b.arena, s); } - fn styled(b: *Builder, s: []const u8, style: Style) !void { + pub fn styled(b: *Builder, s: []const u8, style: Style) !void { const lo: u32 = @intCast(b.text.items.len); try b.text.appendSlice(b.arena, s); try b.spans.append(b.arena, .{ .lo = lo, .hi = @intCast(b.text.items.len), .style = style }); } + + /// The cells the row being built takes so far, the prefix's before the + /// first row's. + pub fn col(b: *const Builder) usize { + const items = b.text.items; + const nl = std.mem.lastIndexOfScalar(u8, items, '\n') orelse return b.lead + panes.File.displayWidth(b.tab, items); + return panes.File.displayWidth(b.tab, items[nl + 1 ..]); + } + + /// The right block (UX D3): what was put from byte `count` on (the + /// count) and from byte `hints` on (the hints) moved to the right end of + /// their row, its last cell the row's last, two spaces between them and + /// at least two before; so it never moves while the field grows toward + /// it. Hints that do not fit go whole, first; the count never does (a + /// head with no room for it runs past its row). + pub fn right(b: *Builder, count: usize, hints: usize) !void { + var h = hints; + b.cut(h, h + spaces(b.text.items[h..])); + const lead_c = spaces(b.text.items[count..h]); + b.cut(count, count + lead_c); + h -= lead_c; + while (h > count and b.text.items[h - 1] == ' ') : (h -= 1) b.cut(h - 1, h); + const items = b.text.items; + const row = if (std.mem.lastIndexOfScalar(u8, items[0..count], '\n')) |nl| nl + 1 else 0; + const left = panes.File.displayWidth(b.tab, items[row..count]) + if (row == 0) b.lead else 0; + var trail: usize = 0; + while (trail < count - row and items[count - 1 - trail] == ' ') trail += 1; + const cw = panes.File.displayWidth(b.tab, items[count..h]); + var hw = panes.File.displayWidth(b.tab, items[h..]); + const between: usize = if (cw > 0) 2 else 0; + if (hw > 0 and left + (2 -| trail) + cw + between + hw > b.width) { + b.text.shrinkRetainingCapacity(h); + var kept: usize = 0; + for (b.spans.items) |span| if (span.lo < h) { + b.spans.items[kept] = span; + kept += 1; + }; + b.spans.shrinkRetainingCapacity(kept); + hw = 0; + } + if (cw + hw == 0) return; + if (cw > 0 and hw > 0) try b.insert(h, 2); + const used = left + cw + (if (cw > 0 and hw > 0) between else 0) + hw; + try b.insert(count, if (used + (2 -| trail) <= b.width) b.width - used else 2 -| trail); + } + + /// `n` spaces put in at byte `at`, the spans after it moved with them. + fn insert(b: *Builder, at: usize, n: usize) !void { + const blank = try b.arena.alloc(u8, n); + @memset(blank, ' '); + try b.text.insertSlice(b.arena, at, blank); + for (b.spans.items) |*span| if (span.lo >= at) { + span.lo += @intCast(n); + span.hi += @intCast(n); + }; + } + + /// Bytes `lo` to `hi` taken out (blanks: no span starts in them). + fn cut(b: *Builder, lo: usize, hi: usize) void { + if (hi <= lo) return; + b.text.replaceRangeAssumeCapacity(lo, hi - lo, &.{}); + for (b.spans.items) |*span| if (span.lo >= hi) { + span.lo -= @intCast(hi - lo); + span.hi -= @intCast(hi - lo); + }; + } + + fn spaces(s: []const u8) usize { + return s.len - std.mem.trimStart(u8, s, " ").len; + } /// The keys typed as 2-cell key cells: the root's, then each key. - fn keyCells(b: *Builder, root: Root, path: []const u8) !void { + pub fn keyCells(b: *Builder, root: Root, path: []const u8) !void { try b.styled(bindings.info.get(root).cell, .key); try b.put(" "); for (path) |k| { @@ -490,7 +574,7 @@ const Builder = struct { } b.cells = @intCast(b.spans.items.len); } - fn done(b: *const Builder) Head { + pub fn done(b: *const Builder) Head { return .{ .text = b.text.items, .spans = b.spans.items, .cells = b.cells }; } }; @@ -502,11 +586,11 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?Head { if (p.panes[id] != pane) return asking(p, arena, pane); const v = p.view(); const s = &v.tag_state; - var b: Builder = .{ .arena = arena }; + var b = try Builder.of(p, arena, pane); switch (s.kind) { .rest => {}, - // `Help`, its scope's keys, the field, its count: - // `Help ␣ l hov 2/17` (out of rest the head starts the tag's + // `Help`, its scope's keys, the field, its count at the row's end: + // `Help ␣ l hov 2/17` (out of rest the head starts the tag's // text, after the owner's and the newest step's words: UX D1). .help => { try b.put("Help "); @@ -514,7 +598,9 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?Head { var h = b.done(); h.caret = @intCast(b.text.items.len + s.field.caret); try b.put(s.field.text()); - try b.text.print(arena, " {d}/{d}", .{ s.nhits, s.ntotal }); + const count = b.text.items.len; + if (s.nhits == 0) try b.put("0") else try b.text.print(arena, "{d}/{d}", .{ s.rows.at + 1, s.nhits }); + try b.right(count, b.text.items.len); h.text = b.text.items; h.spans = b.spans.items; return h; @@ -542,9 +628,16 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?Head { try b.put(" "); try b.put(c.label); }; - try b.put(" ⏎ run · esc"); + const hints = b.text.items.len; + try b.styled("⏎ run · esc", .dim); + try b.right(hints, hints); } else try b.put("…"); - } else try b.put("… press a key or a sequence · esc"); + } else { + try b.put("…"); + const hints = b.text.items.len; + try b.styled("press a key or a sequence · esc", .dim); + try b.right(hints, hints); + } return b.done(); }, .pick => return @import("Pick.zig").head(p, arena, pane), @@ -558,7 +651,9 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?Head { var h = b.done(); h.caret = @intCast(b.text.items.len + s.field.caret); try b.put(s.field.text()); - try b.put(" ⏎ rename · esc"); + const hints = b.text.items.len; + try b.styled("⏎ rename · esc", .dim); + try b.right(hints, hints); h.text = b.text.items; h.spans = b.spans.items; return h; @@ -569,7 +664,9 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?Head { const node = bindings.nodeAt(cur.root, cur.path) orelse return b.done(); if (s.unrolled) { try b.put(if (cur.path.len == 0) bindings.info.get(cur.root).label else node.label); - try b.put(" ↑ roll up · ? field · esc"); + const hints = b.text.items.len; + try b.styled("↑ roll up · ? field · esc", .dim); + try b.right(hints, hints); return b.done(); } try b.styled("▸", .key); @@ -688,6 +785,57 @@ test "SPC changes nothing in the tag until its level shows 250 ms on, its keys o try std.testing.expect(p.view().tag_state.root == null); } +fn firstRow(tag: []const u8) []const u8 { + return tag[0 .. std.mem.indexOfScalar(u8, tag, '\n') orelse tag.len]; +} + +test "the right block: the count `cursor/matches` at the row's right end, fixed while the field grows; the hints after it, dim, dropped whole where the row has no room" { + const Key = pardes.Key; + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 60, .rows = 30 }); + defer p.deinit(); + _ = try p.setTestFile("one\n"); + var frame = std.heap.ArenaAllocator.init(std.testing.allocator); + defer frame.deinit(); + const a = frame.allocator(); + const tab = p.settings.tab; + const width = tagline.tagWidth(p, p.view().active); + p.update(.{ .key = .{ .cp = ' ' } }); + p.update(.{ .key = .{ .cp = '?' } }); + const s = &p.view().tag_state; + var row = firstRow(try testTag(p, a)); + try std.testing.expect(std.mem.startsWith(u8, row, "Help ")); + try std.testing.expectEqual(width, panes.File.displayWidth(tab, row)); + try std.testing.expect(std.mem.endsWith(u8, row, try std.fmt.allocPrint(a, " 1/{d}", .{s.nhits}))); + // Typed into: the field grows toward the count, which stays put. + for ("wr") |c| p.update(.{ .key = .{ .cp = c, .text = &[_]u8{c} } }); + row = firstRow(try testTag(p, a)); + try std.testing.expect(std.mem.startsWith(u8, row, "Help wr ") and s.nhits > 1); + try std.testing.expectEqual(width, panes.File.displayWidth(tab, row)); + try std.testing.expect(std.mem.endsWith(u8, row, try std.fmt.allocPrint(a, " 1/{d}", .{s.nhits}))); + // The cursor's row is the count's first number. + p.update(.{ .key = .{ .cp = Key.down } }); + try std.testing.expect(std.mem.endsWith(u8, firstRow(try testTag(p, a)), try std.fmt.allocPrint(a, " 2/{d}", .{s.nhits}))); + p.update(.{ .key = .{ .cp = Key.escape } }); + // Unrolled: the hints at the row's end, dim. + p.update(.{ .key = .{ .cp = ' ' } }); + p.update(.{ .key = .{ .cp = Key.down } }); + row = firstRow(try testTag(p, a)); + try std.testing.expect(std.mem.startsWith(u8, row, "␣ SPC ")); + try std.testing.expect(std.mem.endsWith(u8, row, " ↑ roll up · ? field · esc")); + try std.testing.expectEqual(width, panes.File.displayWidth(tab, row)); + const h = (try head(p, a, p.panes[p.view().active].?)).?; + const last = h.spans[h.spans.len - 1]; + try std.testing.expect(last.style == .dim and last.hi == h.text.len); + p.update(.{ .key = .{ .cp = Key.escape } }); + // Where the row has no room for them, the hints go whole. + const narrow = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 24, .rows = 30 }); + defer narrow.deinit(); + _ = try narrow.setTestFile("one\n"); + narrow.update(.{ .key = .{ .cp = ' ' } }); + narrow.update(.{ .key = .{ .cp = Key.down } }); + try std.testing.expectEqualStrings("␣ SPC", firstRow(try testTag(narrow, a))); +} + test "a leaf run from a level is remembered: underlined there, and said on the line under it" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 30 }); defer p.deinit(); diff --git a/test/snapshots/find.golden b/test/snapshots/find.golden index 8cef240d..83fd76dc 100644 --- a/test/snapshots/find.golden +++ b/test/snapshots/find.golden @@ -41,7 +41,7 @@ | | /tmp/pardes-snap/find/cwd/here.txt:1 == snap armed grid=120x41 cursor=11,2 -|2: ^ ␣ f Find 1/5 +|2: ^ ␣ f Find 1/5 |3: │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Grep Recent Panes Symbols All Jumplist |4: │ │ ▶ here.txt |5: │ │ other.txt @@ -51,7 +51,7 @@ |9: 1 Find zqm |40: ✓ /tmp/pardes-snap/find/cwd/here.txt Find 1 message · SPC h m == snap typing grid=120x41 cursor=14,2 -|2: ^ ␣ f Find zqm 1/3 +|2: ^ ␣ f Find zqm 1/3 |4: │ │ ▶ zqmark-alpha.txt |5: │ │ sub/ZQMARK-beta.txt |6: │ │ sub/nest/zqmark-gamma.txt @@ -59,7 +59,7 @@ |8: │ │ |9: 1 alpha body == snap next grid=120x41 cursor=14,2 -|2: ^ ␣ f Find zqm 2/3 +|2: ^ ␣ f Find zqm 2/3 |4: │ │ zqmark-alpha.txt |5: │ │ ▶ sub/ZQMARK-beta.txt |9: 1 beta body @@ -73,7 +73,7 @@ |8: |9: == snap nomatch grid=120x41 cursor=30,2 -|2: ^ Find zqm 2/3 › ␣ f Find zzqq 0/0 +|2: ^ Find zqm 2/3 › ␣ f Find zzqq 0 |3: │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Grep Recent Panes Symbols All Jumplist |4: │ │ nothing matches |5: │ │ @@ -86,7 +86,7 @@ |5: |6: == snap topbar grid=120x41 cursor=29,2 -|2: ^ Find zqm 2/3 › ␣ f Find bod 0/0 +|2: ^ Find zqm 2/3 › ␣ f Find bod 0 |3: │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Grep Recent Panes Symbols All Jumplist |4: │ │ nothing matches |5: │ │ diff --git a/test/snapshots/fsearch.golden b/test/snapshots/fsearch.golden index bf8957df..dd1d34e5 100644 --- a/test/snapshots/fsearch.golden +++ b/test/snapshots/fsearch.golden @@ -31,22 +31,12 @@ | | · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program draws next replaces it (Ctrl-b types to the program) 1 message · SPC h m == snap slash grid=180x31 cursor=101,16 -|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › / ⏎ land · M-⏎ as a list · C-r history · esc +|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › / ⏎ land · M-⏎ as a list · C-r history · esc == snap typing grid=180x31 cursor=105,16 -|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › / MARK = Look /MARK/ 1/3 · 3 lines ⏎ land · M-⏎ as a list · C-r history · es -|17: ls c -|18: g.txt 1 l1 -|19: 2▸MARK a -|20: 3 l3 -|21: 4 l4 -|22: 5 l5 -|23: 6▪MARK b -|24: 7 l7 -|25: 8 l8 -|26: 9 l9 -|27: 10▪MARK c -|28: 11 l11 -|29: 12 l12 +|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › / MARK = Look /MARK/ 1/3 · 3 lines ⏎ land · M-⏎ as a list · C-r history · esc +|18: g.txt 2▸MARK a +|22: 6▪MARK b +|26: 10▪MARK c == style typing grid=180x31 |0: 0-1 d,#1d2824, 2-179 #b2c3b8,#1d2824, |1: 0-1 d,#887455, 2-89 #b2c3b8,#1d2824, 90-91 #b2c3b8,#887455, 92-179 #becfc4,#314738, @@ -64,23 +54,23 @@ |13: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-179 d,#0d1410, |14: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-179 d,#0d1410, |15: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-179 d,#0d1410, -|16: 0-1 d,#496656, 2-30 #b2c3b8,#1d2824, 31-40 #d3b0d9,#1d2824, 41-89 #b2c3b8,#1d2824, 90-91 #000000,#add38a, 92-98 #becfc4,#2c2819, 99-99 #add38a,#2c2819,b 100-100 #add38a,#2c2819, 101-104 #becfc4,#2c2819, 105-112 #becfc4,#2c2819,f 113-138 #becfc4,#2c2819, 139-179 #becfc4,#2c2819,f -|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-91 #e5eee5,#2c2819, 92-92 #becfc4,#2c2819,f 93-179 #becfc4,#2c2819, -|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 #e5eee5,#e5eee5, 91-94 #e5eee5,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, -|19: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-94 d,#0d1410,b 95-95 #616f64,#0d1410,b 96-96 #add38a,#0d1410,b 97-100 #f5f7ee,#3c614a, 101-101 #f5f7ee,#0d1410, 102-179 #e5eee5,#0d1410, +|16: 0-1 d,#496656, 2-30 #b2c3b8,#1d2824, 31-40 #d3b0d9,#1d2824, 41-89 #b2c3b8,#1d2824, 90-91 #000000,#add38a, 92-98 #becfc4,#2c2819, 99-99 #add38a,#2c2819,b 100-100 #add38a,#2c2819, 101-104 #becfc4,#2c2819, 105-112 #becfc4,#2c2819,f 113-137 #becfc4,#2c2819, 138-179 #becfc4,#2c2819,f +|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 #e5eee5,#608269, 91-94 #e5eee5,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 #e5eee5,#e5eee5, 91-91 #e5eee5,#0d1410, 92-94 #e5eee5,#0d1410,b 95-95 #616f64,#0d1410,b 96-96 #add38a,#0d1410,b 97-100 #f5f7ee,#3c614a, 101-101 #f5f7ee,#0d1410, 102-179 #e5eee5,#0d1410, +|19: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, |20: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, |21: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, -|22: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#5e4923, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, -|23: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-94 d,#0d1410, 95-95 #59675c,#0d1410, 96-96 #add38a,#0d1410, 97-100 #e5eee5,#352e19, 101-179 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#5e4923, 91-94 d,#0d1410, 95-95 #59675c,#0d1410, 96-96 #add38a,#0d1410, 97-100 #e5eee5,#352e19, 101-179 #e5eee5,#0d1410, +|23: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, |24: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, |25: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, -|26: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, -|27: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#5e4923, 91-93 d,#0d1410, 94-95 #59675c,#0d1410, 96-96 #add38a,#0d1410, 97-100 #e5eee5,#352e19, 101-179 #e5eee5,#0d1410, +|26: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#5e4923, 91-93 d,#0d1410, 94-95 #59675c,#0d1410, 96-96 #add38a,#0d1410, 97-100 #e5eee5,#352e19, 101-179 #e5eee5,#0d1410, +|27: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-93 d,#0d1410, 94-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, |28: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-93 d,#0d1410, 94-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, -|29: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-93 d,#0d1410, 94-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-179 d,#0d1410, |30: 0-1 d,#1d2824, 2-179 #67756e,#1d2824, == snap list grid=180x31 cursor=110,16 -|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › ␣ l /MARK/ 1/3 +|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › ␣ l /MARK/ 1/3 |17: ls │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Find Grep Recent Panes Symb |18: g.txt ols All Jumplist |19: ▶ /tmp/pardes-snap/fsearch/cwd/g.txt:2:1: MARK a @@ -95,7 +85,7 @@ |28: 7 l7 |29: 8 l8 == snap ctrln grid=180x31 cursor=110,16 -|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › ␣ l /MARK/ 2/3 +|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › ␣ l /MARK/ 2/3 |19: /tmp/pardes-snap/fsearch/cwd/g.txt:2:1: MARK a |20: ▶ /tmp/pardes-snap/fsearch/cwd/g.txt:6:1: MARK b |22: 2 MARK a @@ -139,5 +129,5 @@ |16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ‹@p1 › g.txt:1 › /MARK/ 2/3 › /tmp/pardes-snap/fsearch/cwd/g.txt Keep Save Term Collapse == snap cancel grid=180x31 cursor=97,23 == snap nomatch grid=180x31 cursor=118,16 -|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › /MARK/ 2/3 › / zzqq = Look /zzqq/ 0 ⏎ land · M-⏎ as a list · C-r history · e -|17: ls sc +|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › /MARK/ 2/3 › / zzqq = Look /zzqq/ 0 ⏎ land · M-⏎ as a list · C-r history · esc +|17: ls diff --git a/test/snapshots/lsp.golden b/test/snapshots/lsp.golden index 445c5d4b..94958ba4 100644 --- a/test/snapshots/lsp.golden +++ b/test/snapshots/lsp.golden @@ -57,7 +57,7 @@ |14: ~ |40: ✓ /tmp/pardes-snap/lsp/cwd/a.zig Hover 1 message · SPC h m == snap symbols grid=120x41 cursor=24,2 -|2: ^ a.zig:8 › ␣ l Symbols 1/3 +|2: ^ a.zig:8 › ␣ l Symbols 1/3 |3: │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Find Grep Recent Panes Symbols All Jumplist |4: │ │ ▶ a.zig:1:7-9 std |5: │ │ a.zig:3:4-9 helper @@ -76,9 +76,9 @@ |18: ~ |40: ✓ /tmp/pardes-snap/lsp/cwd/a.zig Symbols 2 messages · SPC h m == snap step grid=120x41 cursor=27,2 -|2: ^ a.zig:8 › ␣ l Symbols jn 0/0 +|2: ^ a.zig:8 › ␣ l Symbols jn 0 |4: │ │ nothing matches |5: │ │ |6: │ │ == snap nothing grid=120x41 cursor=29,2 -|2: ^ a.zig:8 › ␣ l Symbols jngd 0/0 +|2: ^ a.zig:8 › ␣ l Symbols jngd 0 diff --git a/test/snapshots/msg.golden b/test/snapshots/msg.golden index 7e622261..4c6f2308 100644 --- a/test/snapshots/msg.golden +++ b/test/snapshots/msg.golden @@ -48,18 +48,12 @@ |9: |16: · reloaded /tmp/pardes-snap/msg/cwd/a.txt 5 messages · SPC h m == snap prompt grid=70x17 cursor=7,2 -|2: ^ s EXT = Exec Edit x/EXT/ 0 ⏎ select · M-⏎ as a list · C-r histo -|3: ry · esc -|4: 1 EXTERNAL -|5: ~ +|2: ^ s EXT = Exec Edit x/EXT/ 0 == snap prompt-wins grid=70x17 cursor=7,2 -|4: 1 AGAIN +|3: 1 AGAIN |16: · reloaded /tmp/pardes-snap/msg/cwd/a.txt ×2 5 messages · SPC h m == snap esc grid=70x17 cursor=7,4 |2: /tmp/pardes-snap/msg/cwd/a.txt Keep Save Term Collapse Follow Del -|3: 1 AGAIN -|4: ~ -|5: == snap msgbuiltin grid=70x17 cursor=29,5 |2: */tmp/pardes-snap/msg/cwd/a.txt Save Term Collapse Follow Del |4: 2 diff --git a/test/snapshots/pipe.golden b/test/snapshots/pipe.golden index a8d2aa31..9ac8ced4 100644 --- a/test/snapshots/pipe.golden +++ b/test/snapshots/pipe.golden @@ -1,7 +1,7 @@ == snap prompt grid=180x13 cursor=14,2 | Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config History Debug Exit | New Term Find Grep Joincol Delcol -|^ | tr a-z A-Z = Exec Edit |tr a-z A-Z 1 line → 1 · exit 0 ⏎ replace · C-r history · esc +|^ | tr a-z A-Z = Exec Edit |tr a-z A-Z 1 line → 1 · exit 0 ⏎ replace · C-r history · esc | 1 alpha beta | ALPHA BETA | 2 gamma delta diff --git a/test/snapshots/selregex.golden b/test/snapshots/selregex.golden index df68f85a..b6e45518 100644 --- a/test/snapshots/selregex.golden +++ b/test/snapshots/selregex.golden @@ -1,7 +1,7 @@ == snap prompt-armed grid=160x25 cursor=4,2 | Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config History Debug Exit | New Term Find Grep Joincol Delcol -|^ s ⏎ select · M-⏎ as a list · C-r history · esc +|^ s ⏎ select · M-⏎ as a list · C-r history · esc | 1┃const one = 1; | 2┃const two = 2; | 3┃const three = 3; @@ -25,12 +25,12 @@ | | /tmp/pardes-snap/selregex/cwd/m.zig:3 == snap preview grid=160x25 cursor=9,2 -|2: ^ s const = Exec Edit x/const/ 3 selections in 3 lines ⏎ select · M-⏎ as a list · C-r history · esc +|2: ^ s const = Exec Edit x/const/ 3 selections in 3 lines ⏎ select · M-⏎ as a list · C-r history · esc |24: /tmp/pardes-snap/selregex/cwd/m.zig:1 == style preview grid=160x25 |0: 0-1 d,#1d2824, 2-159 #b2c3b8,#1d2824, |1: 0-1 d,#887455, 2-159 #becfc4,#314738, -|2: 0-1 #000000,#add38a, 2-2 #add38a,#2c2819,b 3-3 #add38a,#2c2819, 4-8 #becfc4,#2c2819, 9-16 #becfc4,#2c2819,f 17-59 #becfc4,#2c2819, 60-103 #becfc4,#2c2819,f 104-159 #becfc4,#2c2819, +|2: 0-1 #000000,#add38a, 2-2 #add38a,#2c2819,b 3-3 #add38a,#2c2819, 4-8 #becfc4,#2c2819, 9-16 #becfc4,#2c2819,f 17-115 #becfc4,#2c2819, 116-159 #becfc4,#2c2819,f |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-5 #616f64,#0d1410,b 6-6 #add38a,#0d1410,b 7-10 #f5f7ee,#3c614a, 11-11 #3c614a,#f5f7ee, 12-12 #3c614a,#0d1410, 13-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-159 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-5 #59675c,#0d1410, 6-6 #add38a,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-12 #3c614a,#0d1410, 13-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-159 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-4 d,#0d1410, 5-5 #59675c,#0d1410, 6-6 #add38a,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-12 #3c614a,#0d1410, 13-20 #e5eee5,#0d1410, 21-21 #f8c082,#0d1410, 22-159 #e5eee5,#0d1410, @@ -64,12 +64,12 @@ |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-12 #3c614a,#0d1410, 13-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-159 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-12 #3c614a,#0d1410, 13-20 #e5eee5,#0d1410, 21-21 #f8c082,#0d1410, 22-159 #e5eee5,#0d1410, == snap narrowed grid=160x25 cursor=21,2 -|2: ^ Edit x/const/ › s t = Exec Edit x/t/ 3 selections in 3 lines ⏎ select · M-⏎ as a list · C-r history · esc +|2: ^ Edit x/const/ › s t = Exec Edit x/t/ 3 selections in 3 lines ⏎ select · M-⏎ as a list · C-r history · esc |3: 1┃const one = 1; |4: 2┃const two = 2; |5: 3┃const three = 3; == style narrowed grid=160x25 -|2: 0-1 #000000,#add38a, 2-17 #becfc4,#2c2819, 18-18 #add38a,#2c2819,b 19-19 #add38a,#2c2819, 20-20 #becfc4,#2c2819, 21-28 #becfc4,#2c2819,f 29-67 #becfc4,#2c2819, 68-111 #becfc4,#2c2819,f 112-159 #becfc4,#2c2819, +|2: 0-1 #000000,#add38a, 2-17 #becfc4,#2c2819, 18-18 #add38a,#2c2819,b 19-19 #add38a,#2c2819, 20-20 #becfc4,#2c2819, 21-28 #becfc4,#2c2819,f 29-115 #becfc4,#2c2819, 116-159 #becfc4,#2c2819,f |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-5 #616f64,#0d1410,b 6-6 #add38a,#0d1410,b 7-10 #e5eee5,#0d1410, 11-11 #3c614a,#f5f7ee, 12-12 #3c614a,#0d1410, 13-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-159 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-5 #59675c,#0d1410, 6-6 #add38a,#0d1410, 7-10 #e5eee5,#0d1410, 11-11 #3c614a,#f5f7ee, 12-12 #3c614a,#0d1410, 13-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-159 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-4 d,#0d1410, 5-5 #59675c,#0d1410, 6-6 #add38a,#0d1410, 7-10 #e5eee5,#0d1410, 11-11 #3c614a,#f5f7ee, 12-12 #3c614a,#0d1410, 13-20 #e5eee5,#0d1410, 21-21 #f8c082,#0d1410, 22-159 #e5eee5,#0d1410, diff --git a/test/snapshots/ttyhelp.golden b/test/snapshots/ttyhelp.golden index 3eb84714..93442263 100644 --- a/test/snapshots/ttyhelp.golden +++ b/test/snapshots/ttyhelp.golden @@ -49,7 +49,7 @@ |20: r SPC and those keys (`Help l`, as `SPC l ?` shows them). Each fills the one +Help: a second |30: ✓ @p1 Help 1 message · SPC h m == snap leaderworks grid=100x31 cursor=12,5 -|5: ^ Help tutor 1/136 +|5: ^ Help tutor 1/1 |6: ▶ SPC h t · Tutor · help│ t Tutor |7: │ Open the tutor, a document to work through. |8: │ keys SPC h t -- cgit v1.3 From 1d440373e90516ace8e45e8e64f2e4ae5d4a4773 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 25 Nov 2026 05:58:33 -0300 Subject: TagState, Pick, Band: computed text breaks between its items only, a hanging indent under the spines, a rolled level three rows at most ending `+N ↓`, the picker's act row one row, a row too long cut with `…` (a path from the left) (walk UI polish P1, UX DESIGN.md D2): the rolled level was one long line wrapped by the tag's grapheme wrap, so a key fell apart from its label (`P`/`ClipPasteBefore`, `l ls`/`p…`, `D d`/`iagnostic end`) and its continuation rows started at the tag's first column under the box; the act row wrapped onto two (`Grep Rec`/`ent`); a band row was clipped at its step's edge; now (TagState.Builder) `keyCell` keeps each key cell's column and `row(indent)` starts a row of the head with a `│` under each key cell left of the indent (UX D5's spines through the tag's continuation rows; `// P2: the rule role`) and blanks up to it; the rolled level puts each child (`key label`) whole, a row's last child followed by the next row from the first child's column, three rows at most (a terminal's: the rows its own text takes, as before), the last one's last fitting child followed by a dim `+N ↓` (N the children not shown; the cells of it and of a struck key kept on the last row), its hints by the right block's rule on its last row (dropped where they do not fit); Pick.head's key cells are the builder's (its head's first spans, as every head's), its act row one row from two cells right of the last spine: the acts, `|`, the other sources, what does not fit dropped from the right (the sources first) and a dim `…` ending it (M-l, M-h reach them); Band.findSpines takes the key cells on whatever row they are (it wanted them on the tag's last row, so a picker's band had no spines and its steps started at the pane's edge: fsearch's list rows); Band.cutRow holds a row to its room with `…`: a path (its directory faint: Find's rows) cut from the left (`…r/Store.zig`), anything else from the right, its marks and faint bytes moved with it; TEST FIRST: TagState.zig "a rolled level breaks between its children only: ..." (SPC's level at 60 columns: three rows, the second and third `│ ` then a child, no row wider than the tag, every child shown whole, the rest counted in the last row's `+N ↓`; SPC h's on one row), Pick.zig "a picker's act row is one row under the spines ..." (60 columns: `│ │ Walk Look ` ... ` …`, a dim `…`), Band.zig "a row longer than its room is cut with `…` ..."; the SPC test reads a level of three rows at most; core-test 1066/1236 (170 skipped); process-test: 3 goldens regenerated and read: leader (the rolled level's second and third rows `│ ` from its first child's column, no child split, the hints at the last row's right end), find (`␣ f`'s hints at the row's end), fsearch (the list picker's act row one row ending `Panes …`, its band rows under spines from two cells right of the last, the body a row up); a user met the split words at every width under ~160 columns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE --- core/Band.zig | 63 +++++++++++++++---- core/Pick.zig | 103 +++++++++++++++++++------------ core/TagState.zig | 139 +++++++++++++++++++++++++++++++++--------- test/snapshots/find.golden | 2 +- test/snapshots/fsearch.golden | 35 +++++------ test/snapshots/leader.golden | 10 +-- 6 files changed, 251 insertions(+), 101 deletions(-) (limited to 'core/Pick.zig') diff --git a/core/Band.zig b/core/Band.zig index 024b6be4..0d4891aa 100644 --- a/core/Band.zig +++ b/core/Band.zig @@ -394,20 +394,16 @@ fn place(band: *Band, p: *Pardes, arena: std.mem.Allocator, pane: *Pane, id: usi band.nsteps = kept; } -/// The display columns of the head's key cells, when they are all on the -/// tag's last row (the spines hang from there). +/// The display columns of the head's key cells: a spine hangs under each, +/// through the tag's rows under them and the band's (UX D5). fn findSpines(band: *Band, p: *Pardes, arena: std.mem.Allocator, pane: *Pane, id: usize) !void { const h = (try TagState.head(p, arena, pane)) orelse return; const whole = try tagline.tagText(p, arena, pane); const shown = try tagline.wrapTag(p.settings.tab, arena, whole, tagline.tagWidth(p, id)); const lead = whole.len - h.text.len; - const last = shown.rows() -| 1; for (h.spans[0..h.cells]) |span| { const at = modal.positionAt(shown.text, shown.fromReal(lead + span.lo)); - if (at.row != last or band.nspines == max_spines) { - band.nspines = 0; - return; - } + if (band.nspines == max_spines) return; band.spines[band.nspines] = @intCast(File.rawDisplayCol(p.settings.tab, modal.lineSlice(shown.text, at.row), at.col)); band.nspines += 1; } @@ -484,16 +480,46 @@ pub fn line(band: *const Band, arena: std.mem.Allocator, tab: u16, y: u16) !Line const lead: []const u8 = if (step.doc) "" else if (row.on) "▶ " else if (row.mark) "• " else " "; try text.appendSlice(arena, lead); col += @intCast(File.displayWidth(tab, lead)); - try parts.append(arena, .{ .col = col, .width = per -| @as(u16, @intCast(File.displayWidth(tab, lead))), .row = row }); const room = per -| @as(u16, @intCast(File.displayWidth(tab, lead))); - const cut = File.byteAtDisplay(tab, row.text, room); - try text.appendSlice(arena, row.text[0..cut]); - col += @intCast(File.displayWidth(tab, row.text[0..cut])); + const fit = try cutRow(arena, tab, row, room); + try parts.append(arena, .{ .col = col, .width = room, .row = fit }); + try text.appendSlice(arena, fit.text); + col += @intCast(File.displayWidth(tab, fit.text)); } } return .{ .text = text.items, .parts = parts.items }; } +/// Row `row` held to `room` cells (UX D2): a longer one cut with `…`, a +/// path (its directory faint: Find's rows) from the left +/// (`…core/Store.zig`), anything else from the right; its marks and faint +/// bytes moved with its text. +fn cutRow(arena: std.mem.Allocator, tab: u16, row: Row, room: u16) !Row { + if (File.displayWidth(tab, row.text) <= room) return row; + var fit = row; + var marks: std.ArrayList(u16) = .empty; + if (row.faint > 0 and row.pre == 0 and room > 1) { + var from = row.text.len; + while (from > 0) { + const before = modal.prevGrapheme(row.text, from); + if (File.displayWidth(tab, row.text[before..]) > room - 1) break; + from = before; + } + fit.text = try std.mem.concat(arena, u8, &.{ "…", row.text[from..] }); + for (row.marks) |m| if (m >= from) try marks.append(arena, @intCast(m - from + "…".len)); + fit.faint = @intCast(if (row.faint > from) row.faint - from + "…".len else "…".len); + } else { + const cut = File.byteAtDisplay(tab, row.text, room -| 1); + fit.text = try std.mem.concat(arena, u8, &.{ row.text[0..cut], if (room > 0) "…" else "" }); + for (row.marks) |m| if (m < cut) try marks.append(arena, m); + fit.key = @intCast(@min(row.key, cut)); + fit.pre = @intCast(@min(row.pre, cut)); + fit.faint = @intCast(@min(row.faint, cut -| fit.pre)); + } + fit.marks = marks.items; + return fit; +} + /// The word under column `col` of band row `y` of pane `id`, at the /// tagline's pitch: what B2 executes and B3 looks at. pub fn wordAt(p: *Pardes, arena: std.mem.Allocator, id: usize, y: u16, col: u16) !?[]const u8 { @@ -518,6 +544,21 @@ fn layerRow(arena: std.mem.Allocator, layer: *const pardes.Layer, row: usize) ![ return out.items; } +test "a row longer than its room is cut with `…`: a path from the left, anything else from the right, its marks and faint bytes moved with it" { + var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); + defer arena.deinit(); + const a = arena.allocator(); + const path = try cutRow(a, 8, .{ .text = "core/deep/dir/Store.zig", .faint = 14, .marks = &.{ 0, 14, 15 } }, 12); + try std.testing.expectEqualStrings("…r/Store.zig", path.text); + try std.testing.expectEqual(@as(u16, 5), path.faint); + try std.testing.expectEqualSlices(u16, &.{ 5, 6 }, path.marks); + const other = try cutRow(a, 8, .{ .text = "a.zig:3:1: hello world", .pre = 9, .marks = &.{ 10, 20 } }, 12); + try std.testing.expectEqualStrings("a.zig:3:1: …", other.text); + try std.testing.expectEqualSlices(u16, &.{10}, other.marks); + const fits = try cutRow(a, 8, .{ .text = "short" }, 12); + try std.testing.expectEqualStrings("short", fits.text); +} + test "SPC Down unrolls the level into a band under the tag's text, the body pushed down and never drawn over; Up on its first row rolls it up" { const Key = pardes.Key; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 40 }); diff --git a/core/Pick.zig b/core/Pick.zig index 8fcc5945..52976f15 100644 --- a/core/Pick.zig +++ b/core/Pick.zig @@ -565,17 +565,8 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?TagState.Head { const s = &p.view().tag_state; var b = try TagState.Builder.of(p, arena, pane); const text = &b.text; - const spans = &b.spans; - var cells: [4][2]u32 = undefined; - var ncells: usize = 0; // SPC's cell, then its keys': `␣ f`. - if (pk.keys.len > 0) for (0..pk.keys.len + 1) |k| { - const name = if (k == 0) "␣" else bindings.keyName(pk.keys.slice()[k - 1]); - cells[ncells] = .{ @intCast(text.items.len), @intCast(text.items.len + name.len) }; - ncells += 1; - try text.appendSlice(arena, name); - try text.append(arena, ' '); - }; + if (pk.keys.len > 0) try b.keyCells(.leader, pk.keys.slice()); try text.appendSlice(arena, pk.word.slice()); try text.append(arena, ' '); for (pk.refined[0..pk.nrefined]) |r| try text.print(arena, "{s} | ", .{r.query.slice()}); @@ -594,38 +585,43 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?TagState.Head { const hints = text.items.len; try b.styled("⏎ wear it · esc", .dim); try b.right(counted, hints); - for (cells[0..ncells]) |c| try spans.append(arena, .{ .lo = c[0], .hi = c[1], .style = .key }); - return .{ .text = text.items, .spans = spans.items, .cells = @intCast(ncells), .caret = caret }; + var h = b.done(); + h.caret = caret; + return h; } try b.right(counted, text.items.len); - // The second row: the spines go on through it from the key cells, - // then the other sources' words, each switching to it. - try text.append(arena, '\n'); - const prefix = try pardes.tagline.prefixIn(p, arena, pane); - const width = pardes.tagline.tagWidth(p, panes.paneIdOf(p, pane) orelse 0); - const lead = File.displayWidth(p.settings.tab, prefix) % @max(1, width); - var col: usize = 0; - for (cells[0..ncells]) |c| { - const at = lead + File.displayWidth(p.settings.tab, text.items[0..c[0]]); - while (col < at) : (col += 1) try text.append(arena, ' '); - try spans.append(arena, .{ .lo = @intCast(text.items.len), .hi = @intCast(text.items.len + "│".len), .style = .key }); - try text.appendSlice(arena, "│"); - col += 1; - } - const nspines: u8 = @intCast(spans.items.len); - try text.appendSlice(arena, if (ncells == 0) "" else " "); - for (acts) |act| if (offered(pk, act)) try text.print(arena, "{s} ", .{act.word}); - try text.appendSlice(arena, "|"); - var first = false; - inline for (comptime std.enums.values(Source)) |src| if (src != .list and src != .messages and src != .themes) { - if (src != pk.source) { - if (!first) try text.append(arena, ' '); - first = false; - try text.appendSlice(arena, words.get(src).word); - } + // The second row, one row (UX D2): under the spines from the key + // cells, from two cells right of the last, the acts, `|`, the other + // sources' words, each switching to it; what does not fit is dropped + // from the right (the sources first) and the row ends in a dim `…` + // (M-l and M-h reach them all). + try b.row(if (b.ncols > 0) b.cols[b.ncols - 1] + 2 else 0); + var offer: [acts.len + 1 + std.enums.values(Source).len][]const u8 = undefined; + var nw: usize = 0; + for (acts) |act| if (offered(pk, act)) { + offer[nw] = act.word; + nw += 1; + }; + offer[nw] = "|"; + nw += 1; + inline for (comptime std.enums.values(Source)) |src| if (src != .list and src != .messages and src != .themes and src != pk.source) { + offer[nw] = words.get(src).word; + nw += 1; }; - for (cells[0..ncells]) |c| try spans.append(arena, .{ .lo = c[0], .hi = c[1], .style = .key }); - return .{ .text = text.items, .spans = spans.items, .cells = nspines, .caret = caret }; + for (offer[0..nw], 0..) |word, i| { + const gap: usize = @intFromBool(i > 0); + const rest: usize = if (i + 1 < nw) 2 else 0; + if (b.col() + gap + File.displayWidth(p.settings.tab, word) + rest > b.width) { + try b.put(if (gap > 0) " " else ""); + try b.styled("…", .dim); + break; + } + try b.put(if (gap > 0) " " else ""); + try b.put(word); + } + var h = b.done(); + h.caret = caret; + return h; } /// The band's rows: as many as the list will show, eleven at most, from @@ -1553,6 +1549,35 @@ test "a picker from a held pane unrolls in a reader made for it: its rows in the try std.testing.expectEqualStrings("pick", pk.query.slice()); } +test "a picker's act row is one row under the spines, two cells right of the last: what does not fit dropped from the right, the sources first, a dim `…` ending it" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 60, .rows = 40 }); + defer p.deinit(); + p.settings.jumps = .walk; + var tmp = std.testing.tmpDir(.{}); + defer tmp.cleanup(); + const a_path = try testFile(p, &tmp, "alpha.zig", "const alpha = 1;\n"); + defer p.gpa.free(a_path); + _ = try p.setTestFile("held\n"); + const asker = p.view().active; + Trail.keep(p.panes[asker].?); + p.stream.engine = .walk; + open(p, asker, .find, "", "", ""); + const reader = p.paneBySerial(live(p).?.landing).?; + var frame = std.heap.ArenaAllocator.init(std.testing.allocator); + defer frame.deinit(); + const a = frame.allocator(); + const tag = try tagOf(p, a, reader); + var rows = std.mem.splitScalar(u8, tag, '\n'); + try std.testing.expect(std.mem.startsWith(u8, rows.next().?, "␣ f Find ")); + const acts_row = rows.next().?; + try std.testing.expect(rows.next() == null); + try std.testing.expect(std.mem.startsWith(u8, acts_row, "│ │ Walk Look ")); + try std.testing.expect(std.mem.endsWith(u8, acts_row, " …")); + try std.testing.expect(File.displayWidth(p.settings.tab, acts_row) <= pardes.tagline.tagWidth(p, reader)); + const h = (try head(p, a, p.panes[reader].?)).?; + try std.testing.expect(h.spans[h.spans.len - 1].style == .dim); +} + test "a picker's keys: Tab marks and moves, M-a all and none, C-SPC refines and Backspace undoes it, M-h switches source keeping the query" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 140, .rows = 50 }); defer p.deinit(); diff --git a/core/TagState.zig b/core/TagState.zig index d70edf47..18fd5fac 100644 --- a/core/TagState.zig +++ b/core/TagState.zig @@ -478,6 +478,9 @@ pub const Builder = struct { width: usize = 0, lead: usize = 0, tab: u16 = 8, + /// Each key cell's column, which a spine hangs under (UX D5). + cols: [Band.max_spines]u16 = undefined, + ncols: u8 = 0, /// A head for pane `pane`'s tag, out of rest in the live view. pub fn of(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !Builder { @@ -517,10 +520,10 @@ pub const Builder = struct { h -= lead_c; while (h > count and b.text.items[h - 1] == ' ') : (h -= 1) b.cut(h - 1, h); const items = b.text.items; - const row = if (std.mem.lastIndexOfScalar(u8, items[0..count], '\n')) |nl| nl + 1 else 0; - const left = panes.File.displayWidth(b.tab, items[row..count]) + if (row == 0) b.lead else 0; + const start = if (std.mem.lastIndexOfScalar(u8, items[0..count], '\n')) |nl| nl + 1 else 0; + const left = panes.File.displayWidth(b.tab, items[start..count]) + if (start == 0) b.lead else 0; var trail: usize = 0; - while (trail < count - row and items[count - 1 - trail] == ' ') trail += 1; + while (trail < count - start and items[count - 1 - trail] == ' ') trail += 1; const cw = panes.File.displayWidth(b.tab, items[count..h]); var hw = panes.File.displayWidth(b.tab, items[h..]); const between: usize = if (cw > 0) 2 else 0; @@ -566,13 +569,34 @@ pub const Builder = struct { } /// The keys typed as 2-cell key cells: the root's, then each key. pub fn keyCells(b: *Builder, root: Root, path: []const u8) !void { - try b.styled(bindings.info.get(root).cell, .key); + try b.keyCell(bindings.info.get(root).cell); + for (path) |k| try b.keyCell(if (k == ' ') "␣" else bindings.keyName(k)); + b.cells = @intCast(b.spans.items.len); + } + + /// One key cell, its column kept for its spine, and the blank after it. + pub fn keyCell(b: *Builder, name: []const u8) !void { + if (b.ncols < b.cols.len) { + b.cols[b.ncols] = @intCast(b.col()); + b.ncols += 1; + } + try b.styled(name, .key); try b.put(" "); - for (path) |k| { - try b.styled(if (k == ' ') "␣" else bindings.keyName(k), .key); - try b.put(" "); + } + + /// A row more of the head (UX D2): the spines on through it under each + /// key cell left of `indent` (UX D5), then blanks up to `indent`, a + /// hanging indent where the row's words start. + pub fn row(b: *Builder, indent: usize) !void { + try b.text.append(b.arena, '\n'); + var at: usize = 0; + for (b.cols[0..b.ncols]) |c| { + if (c >= indent) break; + try b.text.appendNTimes(b.arena, ' ', c - at); + try b.styled("│", .key); // P2: the rule role (UX D4) + at = c + 1; } - b.cells = @intCast(b.spans.items.len); + try b.text.appendNTimes(b.arena, ' ', indent -| at); } pub fn done(b: *const Builder) Head { return .{ .text = b.text.items, .spans = b.spans.items, .cells = b.cells }; @@ -670,31 +694,35 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?Head { return b.done(); } try b.styled("▸", .key); - // The rolled level wraps to three rows at most (SPEC §3.6): what does - // not fit is `…`, and `↓` unrolls it whole. A terminal's to the rows its - // own text takes: its pty is its body, and a which-key that took a row - // would resize the program under it at every SPC. Every cell is - // counted: the prefix, each child with its separator and a group's - // `…`, the ` …` after a child that is not the last, a struck key, the - // hint (left out, a terminal's tag took a row more at some widths). - const hint = " ↓ unroll · ? help"; - const more = " …"; - const prefix = try tagline.prefixIn(p, arena, pane); + // The rolled level breaks between its children only (UX D2), each row + // after the first from the first child's column, its spines on through + // it; three rows at most, the last ending `+N ↓` (N the children not + // shown, `↓` unrolls them) when they do not fit. A terminal's to the + // rows its own text takes: its pty is its body, and a which-key that + // took a row would resize the program under it at every SPC. const tab = p.settings.tab; const most: usize = if (pane.isTerminal()) @import("layout.zig").wantedTagRows(p, id) else 3; - const struck: usize = if (s.miss != 0) 1 + panes.File.displayWidth(tab, bindings.keyName(s.miss)) else 0; - const room = most * tagline.tagWidth(p, id) -| panes.File.displayWidth(tab, prefix) -| panes.File.displayWidth(tab, hint) -| struck; var children: [bindings.max_children]bindings.Child = undefined; const level = bindings.level(p, cur.root, cur.path, &children); const used = s.used[node.group]; - var width = panes.File.displayWidth(tab, b.text.items); + const indent = b.col() + 1; + // A struck key goes after the children: the last row keeps its cells. + const struck: usize = if (s.miss != 0) 1 + panes.File.displayWidth(tab, bindings.keyName(s.miss)) else 0; + var rows: usize = 1; for (level, 0..) |c, i| { - width += @as(usize, if (i == 0) 1 else 2) + panes.File.displayWidth(tab, bindings.keyName(c.key)) + 1 + panes.File.displayWidth(tab, c.label) + @intFromBool(c.group); - if (width + @as(usize, if (i + 1 < level.len) panes.File.displayWidth(tab, more) else 0) > room) { - try b.put(more); + const w = panes.File.displayWidth(tab, bindings.keyName(c.key)) + 1 + panes.File.displayWidth(tab, c.label) + @intFromBool(c.group or c.more); + var gap: usize = if (i == 0) 1 else 2; + if (b.col() + gap + w + more(level.len - i - 1, rows == most) + (if (rows == most) struck else 0) > b.width and rows < most and b.col() > indent) { + try b.row(indent); + rows += 1; + gap = 0; + } + if (b.col() + gap + w + more(level.len - i - 1, rows == most) + (if (rows == most) struck else 0) > b.width) { + try b.put(if (gap == 0) "" else " "); + try b.styled(try std.fmt.allocPrint(arena, "+{d} ↓", .{level.len - i}), .dim); break; } - try b.put(if (i == 0) " " else " "); + try b.put(if (gap == 0) "" else if (gap == 1) " " else " "); const lo: u32 = @intCast(b.text.items.len); try b.styled(bindings.keyName(c.key), .key); try b.put(" "); @@ -705,13 +733,24 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?Head { if (c.key == used) try b.spans.append(arena, .{ .lo = lo, .hi = hi, .style = .under }); } if (s.miss != 0) { - try b.put(" "); + if (b.col() + struck > b.width and rows < most) try b.row(indent) else try b.put(" "); try b.styled(bindings.keyName(s.miss), .strike); } - try b.put(hint); + // Its hints on its last row, by the right block's rule (UX D3). + const hints = b.text.items.len; + try b.styled("↓ unroll · ? help", .dim); + try b.right(hints, hints); return b.done(); } +/// The cells `+N ↓` takes after a child on a rolled level's last row, with +/// `n` children after it. +fn more(n: usize, last: bool) usize { + if (n == 0 or !last) return 0; + // Two blanks, `+`, N, a blank, `↓`. + return 5 + std.fmt.count("{d}", .{n}); +} + fn testTag(p: *Pardes, arena: std.mem.Allocator) ![]const u8 { return tagline.tagText(p, arena, p.panes[p.view().active].?); } @@ -748,7 +787,7 @@ test "SPC changes nothing in the tag until its level shows 250 ms on, its keys o const level = try testTag(p, a); try std.testing.expect(std.mem.indexOf(u8, level, "␣ ▸ b buffer…") != null); try std.testing.expect(std.mem.indexOf(u8, level, "l lsp…") != null); - try std.testing.expect(std.mem.endsWith(u8, level, "↓ unroll · ? help")); + try std.testing.expect(std.mem.count(u8, level, "\n") < 3); // Down a level: its keys, its children. p.update(.{ .key = .{ .cp = 'l' } }); try std.testing.expect(std.mem.startsWith(u8, try testTag(p, a), "␣ l ▸ a CodeAction b Callstack")); @@ -836,6 +875,50 @@ test "the right block: the count `cursor/matches` at the row's right end, fixed try std.testing.expectEqualStrings("␣ SPC", firstRow(try testTag(narrow, a))); } +test "a rolled level breaks between its children only: the rows after the first from its first child's column under the spines, three at most, the last ending `+N ↓`" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 60, .rows = 30 }); + defer p.deinit(); + _ = try p.setTestFile("one\n"); + var frame = std.heap.ArenaAllocator.init(std.testing.allocator); + defer frame.deinit(); + const a = frame.allocator(); + const tab = p.settings.tab; + const width = tagline.tagWidth(p, p.view().active); + p.update(.{ .key = .{ .cp = ' ' } }); + p.advance(p.clock.now_ns); + p.clock.now_ns = p.view().tag_state.due_ns; + const tag = try testTag(p, a); + var rows: [8][]const u8 = undefined; + var n: usize = 0; + var split = std.mem.splitScalar(u8, tag, '\n'); + while (split.next()) |row| : (n += 1) rows[n] = row; + try std.testing.expectEqual(@as(usize, 3), n); + try std.testing.expect(std.mem.startsWith(u8, rows[0], "␣ ▸ b buffer… ")); + // Each row after the first: the spine under `␣`, then from the first + // child's column; no row wider than the tag. + for (rows[1..n]) |row| try std.testing.expect(std.mem.startsWith(u8, row, "│ ") and row["│ ".len] != ' '); + for (rows[0..n]) |row| try std.testing.expect(panes.File.displayWidth(tab, row) <= width); + // Every child shown is whole on one row; the ones not shown are counted. + var children: [bindings.max_children]bindings.Child = undefined; + const level = bindings.level(p, .leader, "", &children); + var whole: usize = 0; + for (level) |c| { + const item = try std.fmt.allocPrint(a, "{s} {s}", .{ bindings.keyName(c.key), c.label }); + for (rows[0..n]) |row| { + if (std.mem.indexOf(u8, row, item) != null) break; + } else continue; + whole += 1; + } + try std.testing.expect(whole > 0 and whole < level.len); + try std.testing.expect(std.mem.endsWith(u8, rows[n - 1], try std.fmt.allocPrint(a, "+{d} ↓", .{level.len - whole}))); + // A level that fits takes one row; its hints at its end where the row + // has room for them, else none. + p.update(.{ .key = .{ .cp = 'h' } }); + const help = try testTag(p, a); + try std.testing.expect(std.mem.indexOfScalar(u8, help, '\n') == null); + try std.testing.expect(std.mem.startsWith(u8, help, "␣ h ▸ b Build ") and std.mem.endsWith(u8, help, " t Tutor")); +} + test "a leaf run from a level is remembered: underlined there, and said on the line under it" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 30 }); defer p.deinit(); diff --git a/test/snapshots/find.golden b/test/snapshots/find.golden index 83fd76dc..6af0405d 100644 --- a/test/snapshots/find.golden +++ b/test/snapshots/find.golden @@ -1,7 +1,7 @@ == snap group grid=120x41 cursor=7,3 | Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config History Debug Exit | New Term Find Grep Joincol Delcol -| ␣ f ▸ c Config f Find g Grep h History n New r Recent s Save ↓ unroll · ? help +| ␣ f ▸ c Config f Find g Grep h History n New r Recent s Save ↓ unroll · ? help | 1 Find zqm | | diff --git a/test/snapshots/fsearch.golden b/test/snapshots/fsearch.golden index dd1d34e5..fe5a29ef 100644 --- a/test/snapshots/fsearch.golden +++ b/test/snapshots/fsearch.golden @@ -71,23 +71,11 @@ |30: 0-1 d,#1d2824, 2-179 #67756e,#1d2824, == snap list grid=180x31 cursor=110,16 |16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › ␣ l /MARK/ 1/3 -|17: ls │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Find Grep Recent Panes Symb -|18: g.txt ols All Jumplist -|19: ▶ /tmp/pardes-snap/fsearch/cwd/g.txt:2:1: MARK a -|20: /tmp/pardes-snap/fsearch/cwd/g.txt:6:1: MARK b -|21: /tmp/pardes-snap/fsearch/cwd/g.txt:10:1: MARK c -|22: 1 l1 -|23: 2 MARK a -|24: 3 l3 -|25: 4 l4 -|26: 5 l5 -|27: 6 MARK b -|28: 7 l7 -|29: 8 l8 -== snap ctrln grid=180x31 cursor=110,16 -|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › ␣ l /MARK/ 2/3 -|19: /tmp/pardes-snap/fsearch/cwd/g.txt:2:1: MARK a -|20: ▶ /tmp/pardes-snap/fsearch/cwd/g.txt:6:1: MARK b +|17: ls │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Find Grep Recent Panes … +|18: g.txt │ │ ▶ /tmp/pardes-snap/fsearch/cwd/g.txt:2:1: MARK a +|19: │ │ /tmp/pardes-snap/fsearch/cwd/g.txt:6:1: MARK b +|20: │ │ /tmp/pardes-snap/fsearch/cwd/g.txt:10:1: MARK c +|21: 1 l1 |22: 2 MARK a |23: 3 l3 |24: 4 l4 @@ -96,6 +84,19 @@ |27: 7 l7 |28: 8 l8 |29: 9 l9 +== snap ctrln grid=180x31 cursor=110,16 +|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › ␣ l /MARK/ 2/3 +|18: g.txt │ │ /tmp/pardes-snap/fsearch/cwd/g.txt:2:1: MARK a +|19: │ │ ▶ /tmp/pardes-snap/fsearch/cwd/g.txt:6:1: MARK b +|21: 2 MARK a +|22: 3 l3 +|23: 4 l4 +|24: 5 l5 +|25: 6 MARK b +|26: 7 l7 +|27: 8 l8 +|28: 9 l9 +|29: 10 MARK c == snap landed grid=180x31 cursor=97,22 |16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ‹@p1 › g.txt:1 › /MARK/ 2/3 › /tmp/pardes-snap/fsearch/cwd/g.txt Keep Save Term Collapse |17: ls Follow Del diff --git a/test/snapshots/leader.golden b/test/snapshots/leader.golden index b93030e8..1f2d4fc5 100644 --- a/test/snapshots/leader.golden +++ b/test/snapshots/leader.golden @@ -2,8 +2,8 @@ | Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config History Debug Exit | New Term Find Grep Joincol Delcol | ␣ ▸ b buffer… c column… f file… h help… j jump… l lsp… n new… s session… t view… ' Resume -| / All ? Help d Del e Message p ClipPaste P ClipPasteBefore q Exit R ClipReplace w Window -| y ClipYank Y ClipYankMain ↓ unroll · ? help +| │ / All ? Help d Del e Message p ClipPaste P ClipPasteBefore q Exit R ClipReplace +| │ w Window y ClipYank Y ClipYankMain ↓ unroll · ? help | 1 Help Help h Help t Help c Help l | | @@ -41,7 +41,7 @@ | | /tmp/pardes-snap/leader/cwd/cmds.txt:1 == snap spc-h grid=100x41 cursor=7,3 -|2: ␣ h ▸ b Build c Changelog k Keys m Messages t Tutor ↓ unroll · ? help +|2: ␣ h ▸ b Build c Changelog k Keys m Messages t Tutor ↓ unroll · ? help |3: 1 Help Help h Help t Help c Help l |4: |5: @@ -49,8 +49,8 @@ |2: /tmp/pardes-snap/leader/cwd/cmds.txt Keep Save Term Collapse Follow Del == snap unmapped grid=100x41 cursor=7,5 |2: ␣ ▸ b buffer… c column… f file… h help… j jump… l lsp… n new… s session… t view… ' Resume -|3: / All ? Help d Del e Message p ClipPaste P ClipPasteBefore q Exit R ClipReplace w Window -|4: y ClipYank Y ClipYankMain x ↓ unroll · ? help +|3: │ / All ? Help d Del e Message p ClipPaste P ClipPasteBefore q Exit R ClipReplace +|4: │ w Window y ClipYank Y ClipYankMain x ↓ unroll · ? help |5: 1 Help Help h Help t Help c Help l == snap help-group grid=100x41 cursor=7,6 |2: /tmp/pardes-snap/leader/cwd/cmds.txt Keep Save Term Collapse Follow Del -- cgit v1.3 From ea9a19700cc1c0bc22c08b1d31d7a62e5853b802 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 25 Nov 2026 06:20:03 -0300 Subject: Pick, layout, Core, Band: the band's height: a picker's from its list at open, four rows at least, 40 % of its column at most, never moved by typing; the body keeps 60 % of its pane and six rows, borrowed from its column, and the band gives way before the body drops under six (walk UI polish P1, UX DESIGN.md D6, C8): a picker's band was as tall as its list (three hits, three rows; no cap), so a short list's band was a sliver and a long one took a short pane's body down to four rows (shot 04-L: four body rows of 18); now Pick.bandRows is min(11, max(4, what the source has), 40 % of the rows of the host's column: its panes' rows, which a borrow only moves between them, so the height never changes while typing), the rows fewer than it leaving the band's ground (and its spines) under them; layout.floorRows keeps a band's pane its band and a body of one and a half times what is above it (60 % of the pane) and six rows at least (Band.body_rows), borrowed from the column's other panes as before; Core.sync's band takes what leaves the body six rows, so a column too short for 60 % shrinks the band, never the body under six; TEST FIRST: Pick.zig "a picker's band is sized from its list at open, 4 rows at least, and typing never moves it" (two files: four rows, the same after `zzq` with nothing matching; on the parent two rows), Band.zig "a band keeps its pane's body 60 % of the pane, borrowed from its column; where the column has not the rows, the band gives way before the body drops under 6" (three panes in 40 rows: the body 60 % of the pane; in 12 rows the band shorter than it wants, the body six), the borrow test's body six rows (was four); core-test 1068/1239 (171 skipped); process-test: find, fsearch, lsp regenerated and read: each picker band four rows where its list has two or three (find's two files, fsearch's three places, lsp's three symbols), the rows under the list the band's ground with the spines on through it, the body that much lower; a user saw a picker's band change size with its source, and a short pane's body crushed Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE --- core/Band.zig | 35 +++++++++++++++++++++++++++++++++-- core/Core.zig | 2 +- core/Pick.zig | 42 ++++++++++++++++++++++++++++++++++++++---- core/layout.zig | 12 ++++++++---- test/snapshots/find.golden | 10 ++++++++-- test/snapshots/fsearch.golden | 27 +++++++++++++-------------- test/snapshots/lsp.golden | 25 +++++++++++++------------ 7 files changed, 114 insertions(+), 39 deletions(-) (limited to 'core/Pick.zig') diff --git a/core/Band.zig b/core/Band.zig index 07c2f83d..e34b6a49 100644 --- a/core/Band.zig +++ b/core/Band.zig @@ -73,6 +73,8 @@ pub const max_spines = 12; pub const min_width = 24; /// A doc's rows, the fewest a band with one has. const doc_rows = 4; +/// The body rows a band leaves its pane at least: it gives way first (UX D6). +pub const body_rows = 6; /// A level's rows past which it flows into two columns. const one_column = 9; @@ -635,7 +637,35 @@ test "SPC Down unrolls the level into a band under the tag's text, the body push try std.testing.expect(!p.view().tag_state.unrolled); } -test "a pane whose body would drop below four rows under its band borrows them from its column" { +test "a band keeps its pane's body 60 % of the pane, borrowed from its column; where the column has not the rows, the band gives way before the body drops under 6" { + const Key = pardes.Key; + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 40 }); + defer p.deinit(); + _ = try p.setTestFile("one\n"); + const top = p.view().active; + p.newScratchBelow(top); + const low = p.view().active; + p.newScratchBelow(low); + p.view().active = low; + p.sync(); + p.update(.{ .key = .{ .cp = ' ' } }); + p.update(.{ .key = .{ .cp = Key.down } }); + const pane = p.panes[low].?; + const r = p.view().rects[low]; + try std.testing.expect(pane.band_rows >= doc_rows); + try std.testing.expect(@as(u32, r.h -| pane.tag_rows) * 5 >= @as(u32, r.h) * 3); + p.update(.{ .key = .{ .cp = Key.escape } }); + // A window of 12 rows: the band shrinks, the body keeps 6. + p.update(.{ .resize = .{ .cols = 120, .rows = 12 } }); + p.update(.{ .key = .{ .cp = ' ' } }); + p.update(.{ .key = .{ .cp = Key.down } }); + p.sync(); + const short = p.view().rects[low]; + try std.testing.expect(short.h -| pane.tag_rows >= 6 or pane.band_rows == 0); + try std.testing.expect(pane.band_rows < Band.takes(p, low)); +} + +test "a pane whose body would drop below six rows under its band borrows them from its column" { const Key = pardes.Key; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 24 }); defer p.deinit(); @@ -652,7 +682,8 @@ test "a pane whose body would drop below four rows under its band borrows them f const pane = p.panes[low].?; const r = p.view().rects[low]; try std.testing.expect(r.h > before); - try std.testing.expect(r.h -| pane.tag_rows >= 4); + // Its body six rows at least (UX D6): a column too short for 60 %. + try std.testing.expect(r.h -| pane.tag_rows >= 6); // No pane dims out of rest (UX D9): the others look as at rest. var frame = std.heap.ArenaAllocator.init(std.testing.allocator); defer frame.deinit(); diff --git a/core/Core.zig b/core/Core.zig index 26860365..5b6eba75 100644 --- a/core/Core.zig +++ b/core/Core.zig @@ -2063,7 +2063,7 @@ pub fn sync(p: *Pardes) void { // The band unrolled under the tag's text pushes the body down: // the tag's rows, as everything under them counts them. // A terminal's or a kind's is drawn over its body instead (Band.over). - pane.band_rows = if (pane.collapsed or pardes.Band.over(pane)) 0 else @min(pardes.Band.takes(p, id), r.h -| pane.tag_rows); + pane.band_rows = if (pane.collapsed or pardes.Band.over(pane)) 0 else @min(pardes.Band.takes(p, id), r.h -| pane.tag_rows -| pardes.Band.body_rows); pane.tag_rows += pane.band_rows; const cols = @max(1, r.w -| config.GUTTER); // The tag steals the top rows. The pty is what the pane shows diff --git a/core/Pick.zig b/core/Pick.zig index 52976f15..52e9601d 100644 --- a/core/Pick.zig +++ b/core/Pick.zig @@ -624,13 +624,18 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?TagState.Head { return h; } -/// The band's rows: as many as the list will show, eleven at most, from -/// what the source has (not what the query keeps: typing never moves the -/// body). +/// The band's rows (UX D6): as many as the list will show, from what the +/// source has (not what the query keeps: typing never moves the body), +/// four at least, eleven at most, and 40 % of the host's column at most +/// (its panes' rows, which a borrow moves between them, never changes). pub fn bandRows(p: *const Pardes) u16 { const pk = live(p) orelse return 0; const have = if (!fuzzy(pk)) Band.Cursor.shown else pk.names.cands.items.len; - const rows: usize = @max(1, @min(Band.Cursor.shown, have)); + const v = p.view(); + const at = @import("layout.zig").findPane(p, TagState.hostOf(p) orelse return 0) orelse return 0; + var column: usize = 0; + for (v.cols[at.col].panes[0..v.cols[at.col].n]) |id| column += v.rects[id].h; + const rows: usize = @max(1, @min(Band.Cursor.shown, @max(4, have), column * 2 / 5)); // Its second step's rows too: the sources, the acts and what they act on. return @intCast(switch (pk.spine) { .sources => @max(rows, spine_rows.len), @@ -1578,6 +1583,35 @@ test "a picker's act row is one row under the spines, two cells right of the las try std.testing.expect(h.spans[h.spans.len - 1].style == .dim); } +test "a picker's band is sized from its list at open, 4 rows at least, and typing never moves it" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 40 }); + defer p.deinit(); + p.settings.jumps = .walk; + var tmp = std.testing.tmpDir(.{}); + defer tmp.cleanup(); + const a_path = try testFile(p, &tmp, "alpha.zig", "const alpha = 1;\n"); + defer p.gpa.free(a_path); + _ = try p.setTestFile("held\n"); + const asker = p.view().active; + Trail.keep(p.panes[asker].?); + // In the test's directory: its two files listed. + p.gpa.free(p.panes[asker].?.file.?.path); + p.panes[asker].?.file.?.path = try std.Io.Dir.path.join(p.gpa, &.{ std.Io.Dir.path.dirname(a_path).?, "held.txt" }); + p.stream.engine = .walk; + open(p, asker, .find, "", "", ""); + settle(p); + const reader = p.paneBySerial(live(p).?.landing).?; + p.sync(); + const rows = p.panes[reader].?.band_rows; + // One or two files listed: four rows, ground under them. + try std.testing.expectEqual(@as(u16, 4), rows); + for ("zzq") |c| p.update(.{ .key = .{ .cp = c, .text = &[_]u8{c} } }); + settle(p); + p.sync(); + try std.testing.expectEqual(@as(usize, 0), count(p, live(p).?)); + try std.testing.expectEqual(rows, p.panes[reader].?.band_rows); +} + test "a picker's keys: Tab marks and moves, M-a all and none, C-SPC refines and Backspace undoes it, M-h switches source keeping the query" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 140, .rows = 50 }); defer p.deinit(); diff --git a/core/layout.zig b/core/layout.zig index de12294b..5550ef4a 100644 --- a/core/layout.zig +++ b/core/layout.zig @@ -1471,13 +1471,17 @@ pub fn compute(p: *Pardes) void { /// The fewest rows a pane is laid out with: a terminal keeps its tag and /// `min_body_rows` (a shorter one loses its prompt and reads busy for /// ever), a text pane may shrink to its tag, as acme's windows do. A tag -/// out of rest keeps its band and four body rows, borrowed from the -/// column's other panes, which shrink to their tags until it rolls up -/// (walk UI SPEC §3.6). +/// out of rest keeps its band and a body of 60 % of the pane and 6 rows at +/// least (UX D6), borrowed from the column's other panes, which shrink to +/// their tags until it rolls up (walk UI SPEC §3.6). fn floorRows(p: *Pardes, id: usize) u16 { const pane = p.panes[id] orelse return 0; const band = if (pardes.Band.over(pane)) 0 else pardes.Band.takes(p, id); - if (band > 0) return @max(1, pane.tag_rows -| pane.band_rows) + band + 4; + if (band > 0) { + const above = @max(1, pane.tag_rows -| pane.band_rows) + band; + // A body of 60 % is one and a half times what is above it. + return above + @max(pardes.Band.body_rows, (3 * above + 1) / 2); + } return if (pane.isTerminal()) @max(1, pane.tag_rows) + min_body_rows else 1; } diff --git a/test/snapshots/find.golden b/test/snapshots/find.golden index 6af0405d..da1b0e4e 100644 --- a/test/snapshots/find.golden +++ b/test/snapshots/find.golden @@ -77,7 +77,9 @@ |3: │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Grep Recent Panes Symbols All Jumplist |4: │ │ nothing matches |5: │ │ -|6: 1 beta body +|6: │ │ +|7: │ │ +|8: 1 beta body |40: ✓ /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Find 2 messages · SPC h m == snap cancel grid=120x41 cursor=7,3 |2: here.txt:1 › Find zqm 2/3 › /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Keep Save Term Collapse Follow Del @@ -85,10 +87,14 @@ |4: |5: |6: +|7: +|8: == snap topbar grid=120x41 cursor=29,2 |2: ^ Find zqm 2/3 › ␣ f Find bod 0 |3: │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Grep Recent Panes Symbols All Jumplist |4: │ │ nothing matches |5: │ │ -|6: 1 beta body +|6: │ │ +|7: │ │ +|8: 1 beta body |40: ✓ /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Find ×2 2 messages · SPC h m diff --git a/test/snapshots/fsearch.golden b/test/snapshots/fsearch.golden index fe5a29ef..905d2ef0 100644 --- a/test/snapshots/fsearch.golden +++ b/test/snapshots/fsearch.golden @@ -75,7 +75,19 @@ |18: g.txt │ │ ▶ /tmp/pardes-snap/fsearch/cwd/g.txt:2:1: MARK a |19: │ │ /tmp/pardes-snap/fsearch/cwd/g.txt:6:1: MARK b |20: │ │ /tmp/pardes-snap/fsearch/cwd/g.txt:10:1: MARK c -|21: 1 l1 +|21: │ │ +|22: 1 l1 +|23: 2 MARK a +|24: 3 l3 +|25: 4 l4 +|26: 5 l5 +|27: 6 MARK b +|28: 7 l7 +|29: 8 l8 +== snap ctrln grid=180x31 cursor=110,16 +|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › ␣ l /MARK/ 2/3 +|18: g.txt │ │ /tmp/pardes-snap/fsearch/cwd/g.txt:2:1: MARK a +|19: │ │ ▶ /tmp/pardes-snap/fsearch/cwd/g.txt:6:1: MARK b |22: 2 MARK a |23: 3 l3 |24: 4 l4 @@ -84,19 +96,6 @@ |27: 7 l7 |28: 8 l8 |29: 9 l9 -== snap ctrln grid=180x31 cursor=110,16 -|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › ␣ l /MARK/ 2/3 -|18: g.txt │ │ /tmp/pardes-snap/fsearch/cwd/g.txt:2:1: MARK a -|19: │ │ ▶ /tmp/pardes-snap/fsearch/cwd/g.txt:6:1: MARK b -|21: 2 MARK a -|22: 3 l3 -|23: 4 l4 -|24: 5 l5 -|25: 6 MARK b -|26: 7 l7 -|27: 8 l8 -|28: 9 l9 -|29: 10 MARK c == snap landed grid=180x31 cursor=97,22 |16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ‹@p1 › g.txt:1 › /MARK/ 2/3 › /tmp/pardes-snap/fsearch/cwd/g.txt Keep Save Term Collapse |17: ls Follow Del diff --git a/test/snapshots/lsp.golden b/test/snapshots/lsp.golden index 94958ba4..06127538 100644 --- a/test/snapshots/lsp.golden +++ b/test/snapshots/lsp.golden @@ -62,18 +62,19 @@ |4: │ │ ▶ a.zig:1:7-9 std |5: │ │ a.zig:3:4-9 helper |6: │ │ a.zig:7:8-11 main -|7: 1 const std = @import("std"); -|8: 2 -|9: 3 fn helper(x: u32) u32 { -|10: fn helper(x: u32) u32 -|11: (fn (u32) u32) -|12: 4 return x + 1; -|13: 5 } -|14: 6 -|15: 7 pub fn main() void { -|16: 8 _ = helper(41); -|17: 9 } -|18: ~ +|7: │ │ +|8: 1 const std = @import("std"); +|9: 2 +|10: 3 fn helper(x: u32) u32 { +|11: fn helper(x: u32) u32 +|12: (fn (u32) u32) +|13: 4 return x + 1; +|14: 5 } +|15: 6 +|16: 7 pub fn main() void { +|17: 8 _ = helper(41); +|18: 9 } +|19: ~ |40: ✓ /tmp/pardes-snap/lsp/cwd/a.zig Symbols 2 messages · SPC h m == snap step grid=120x41 cursor=27,2 |2: ^ a.zig:8 › ␣ l Symbols jn 0 -- cgit v1.3