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/Prompt.zig | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'core/Prompt.zig') diff --git a/core/Prompt.zig b/core/Prompt.zig index 64e030e0..10886606 100644 --- a/core/Prompt.zig +++ b/core/Prompt.zig @@ -809,8 +809,9 @@ pub fn execWord(p: *Pardes, id: usize) void { /// The span of pane `pane`'s tag its search word takes while its places no /// longer light it (the first Esc cleared them): drawn dimmed (draw.zig). pub fn unlit(p: *const Pardes, pane: *Pane) ?[2]usize { + if (Trail.outOfRest(p, pane)) return null; const t = &pane.trail; - const whole = Trail.folded(p, pane); + const whole = Trail.shown_steps; for (t.steps[0..t.cur], 0..) |*step, i| if (step.* == .search) { if (lights(pane, &step.search) or t.cur - i > whole) return null; return t.spanOf(i, whole); @@ -1056,14 +1057,13 @@ fn strike(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, line: i32, lo_: } } -/// The head of the prompt's tag: ` s self▌ = Exec Edit x/self/ 4 +/// The head of the prompt's tag: `s self▌ = Exec Edit x/self/ 4 /// selections in 6 lines ⏎ select · M-⏎ as a list · C-r history · esc`. 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 text.append(arena, ' '); 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); @@ -1269,9 +1269,9 @@ 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(std.mem.endsWith(u8, 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.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); try std.testing.expect(selecting(p, pane).?.dim == false); // No match: 0, and the selection it began with. @@ -1310,10 +1310,10 @@ test "Enter keeps what s found, the pattern in / and in the history Up brings ba typeKeys(p, "K"); p.update(.{ .key = .{ .cp = Key.up } }); try std.testing.expectEqualStrings("self..", p.view().tag_state.field.text()); - try std.testing.expect(has(try tagOf(p), " K self.. = Exec Edit g/self../ keeps 2 of 2")); + try std.testing.expect(has(try tagOf(p), "K self.. = Exec Edit g/self../ keeps 2 of 2")); p.update(.{ .key = .{ .cp = Key.down } }); typeKeys(p, "b"); - try std.testing.expect(has(try tagOf(p), " K b = Exec Edit g/b/ keeps 1 of 2 ⏎ keep")); + try std.testing.expect(has(try tagOf(p), "K b = Exec Edit g/b/ keeps 1 of 2 ⏎ keep")); // Ctrl-r: the history under the tag, a row a line. p.update(.{ .key = .{ .cp = 'r', .ctrl = true } }); try std.testing.expectEqual(@as(u16, 1), Band.takes(p, p.view().active)); @@ -1325,7 +1325,7 @@ test "Enter keeps what s found, the pattern in / and in the history Up brings ba typeKeys(p, "|"); try std.testing.expectEqual(Pane.Prompt.none, pane.prompt); p.update(.{ .key = .{ .cp = 't', .text = "tr a-z A-Z" } }); - try std.testing.expect(has(try tagOf(p), " | tr a-z A-Z = Exec Edit |tr a-z A-Z ⋯ ⏎ replace")); + try std.testing.expect(has(try tagOf(p), "| tr a-z A-Z = Exec Edit |tr a-z A-Z ⋯ ⏎ replace")); p.update(.{ .key = .{ .cp = Key.enter } }); try std.testing.expectEqualStrings("tr a-z A-Z", p.registers.value('|', 0).?); var asked: ?u32 = null; @@ -1362,7 +1362,7 @@ test "/ searches the body as it is typed: the current place selected, the gutter pane.body.cur_row = 2; pane.body.cur_col = 6; typeKeys(p, "/dirty"); - try std.testing.expect(has(try tagOf(p), " / dirty = Look /dirty/ 3/7 · 5 lines ⏎ land · M-⏎ as a list")); + try std.testing.expect(has(try tagOf(p), "/ dirty = Look /dirty/ 3/7 · 5 lines ⏎ land · M-⏎ as a list")); try std.testing.expectEqual(@as(?usize, 2), pane.places.current); try std.testing.expectEqualStrings("▪", try gutterAt(p, frame.allocator(), 0)); try std.testing.expectEqualStrings(" ", try gutterAt(p, frame.allocator(), 1)); @@ -1409,7 +1409,7 @@ test "? searches back from the caret; no match is 0; a pattern that is no regex pane.body.cur_col = 6; const was = pane.body.primaryRange(pane.file.?.content, 0); typeKeys(p, "?dirty"); - try std.testing.expect(has(try tagOf(p), " ? dirty = Look ?dirty? 2/7 · 5 lines ⏎ land")); + try std.testing.expect(has(try tagOf(p), "? dirty = Look ?dirty? 2/7 · 5 lines ⏎ land")); typeKeys(p, "x"); try std.testing.expect(has(try tagOf(p), "= Look ?dirtyx? 0 ⏎ land")); try std.testing.expectEqualDeep(was, pane.body.primaryRange(pane.file.?.content, 0)); @@ -1497,7 +1497,7 @@ test "a pipe prompt runs a known filter live, a run a selection: the outputs gho p.update(.{ .key = .{ .cp = Key.enter } }); typeKeys(p, "|"); p.update(.{ .key = .{ .cp = 't', .text = "tr a-z A-Z" } }); - try std.testing.expect(has(try tagOf(p), " | tr a-z A-Z = Exec Edit |tr a-z A-Z ⋯ ⏎ replace")); + try std.testing.expect(has(try tagOf(p), "| tr a-z A-Z = Exec Edit |tr a-z A-Z ⋯ ⏎ replace")); const first = lastPipe(p) orelse return error.MissingLiveRun; const asked = p.pipe.pipeRequest(first).?; try std.testing.expectEqual(@as(usize, 2), asked.inputs.len); -- 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/Prompt.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 c51ecfb07e4c5d091d0155c609205c7e5f6bc0b1 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 25 Nov 2026 06:31:43 -0300 Subject: Trail, tagline, draw, Prompt: the trail at rest: the steps past the newest three fold into one dim `+N ›` after the owner, fewer whole while the walk would add a row to the tag, the forward steps past two into one `› +N`, two files of the same name told apart by the shortest end of their paths, the word n walks underlined (walk UI polish P1, UX DESIGN.md D8, C3): each folded step was a `·` of its own (four cells each, nameless), the walk took the rows it wanted (05a-L, 05b-L: a reader's tag two rows at rest, so a jump moved the body), and two `x.zig` steps read alike; now Trail.foldOf names the folded steps (back: those older than the newest `whole`, never the owner; forward: those past `shown_ahead` = 2), Trail.wordIn writes the first of them as `+N` and nothing for the others (out of rest `.newest` as D1 made it), Trail.stepAt maps a click on `+N` to the step nearest the path among those it holds (a Look on `+2` goes back to the newest hidden step: the band step D8 asks for, the whole trail unrolled newest first, is not built), wordOf names a place by the shortest end of its path no other step's file shares (`core/rank.zig:2` beside `/rank.zig:12`; the same file at two lines keeps its basename), Trail.walked is the newest list or search back step (what Pick.walkList and the prompts' n walk) and draw.paintPaneTag underlines it in the box's ink (`// P2: the key role`), the fold's `+N` drawn in the forward steps' dim ink; tagline.folded is how many back steps stay whole: three, fewer down to the newest one while the walk's cells would make the tag at rest take more rows than it takes with no walk (the tag's cells, not its wrap: one line), which nameAt, forwardSpan, trailAt, onName, restPath and Prompt.unlit read (Trail.folded's constant `shown_steps` until now); seed 109 of ninep's random placements is NOT fixed by it (tried with the test under the walk: column 2 under its minimums at step 36, the newest step alone still adds a row in a column with no rows to give), so that test keeps `Jumps new-pane`; TEST FIRST: Trail.zig "a trail keeps its newest three back steps whole, older ones fold into one dim `+N` after the owner ..." (six steps at 400 columns: `‹@pN › +2 › rank.zig:30 › rank.zig:40 › rank.zig:50 ›`, the `+2` in the dim ink, a click on it back at rank.zig:20; back at the first, `› rank.zig:20 › rank.zig:30 › +3 Keep`; on the parent `· ›` per step: fails), "the walk never adds a row to a tag at rest ..." (a width 35 cells past the bare tag: one row with a `+N` fold; on the parent two rows), "two steps whose files have the same name are told apart ...; the word n walks is underlined"; core-test 1071/1242 (171 skipped); process-test: fsearch and lookrange regenerated and read: fsearch's landed/n/N reader tag `‹@p1 › +1 › /MARK/ 2/3 › …/g.txt Keep ...` (its two rows at rest: the newest alone still wraps there, g.txt:1 folded), lookrange's hit1/hit2/back style rows underline `/NEEDLE/ 2/2` (cols 2-13), the word n walks; a user saw the body move a row at a jump 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/Prompt.zig | 4 +- core/Trail.zig | 192 +++++++++++++++++++++++++++++++++------- core/draw.zig | 35 ++++++-- core/tagline.zig | 53 ++++++++--- test/snapshots/fsearch.golden | 8 +- test/snapshots/lookrange.golden | 4 +- 6 files changed, 236 insertions(+), 60 deletions(-) (limited to 'core/Prompt.zig') diff --git a/core/Prompt.zig b/core/Prompt.zig index 27b59649..c3d9959a 100644 --- a/core/Prompt.zig +++ b/core/Prompt.zig @@ -811,9 +811,9 @@ pub fn execWord(p: *Pardes, id: usize) void { pub fn unlit(p: *const Pardes, pane: *Pane) ?[2]usize { if (Trail.outOfRest(p, pane)) return null; const t = &pane.trail; - const whole = Trail.shown_steps; + const whole = pardes.tagline.folded(p, pane); for (t.steps[0..t.cur], 0..) |*step, i| if (step.* == .search) { - if (lights(pane, &step.search) or t.cur - i > whole) return null; + if (lights(pane, &step.search) or t.isFolded(i, whole)) return null; return t.spanOf(i, whole); }; return null; diff --git a/core/Trail.zig b/core/Trail.zig index 58a72256..e22a58b6 100644 --- a/core/Trail.zig +++ b/core/Trail.zig @@ -318,18 +318,36 @@ pub fn walkBy(p: *Pardes, id: usize, delta: i32) bool { pub const Part = enum { back, forward, newest }; /// Step `i`'s word: `‹@p3`, `rank.zig:14`, a list's, search's or recipe's -/// own text; `·` when it is folded. -fn wordOf(t: *const Trail, i: usize, whole: usize, buf: *[max_text + 16]u8) []const u8 { - const s = &t.steps[i]; - if (s.* != .owner and i < t.cur and t.cur - i > whole) return "·"; +/// own text. A place's file is named by its basename, or where another +/// step's file has the same one, by the shortest end of its path the other +/// does not share (UX D8: `core/x.zig:3` beside `dev/x.zig:9`). +fn wordOf(t: *const Trail, i: usize, buf: *[max_text + 16]u8) []const u8 { // The step itself, not a copy: a word's text is the step's own bytes. - return switch (s.*) { + return switch (t.steps[i]) { .owner => |serial| std.fmt.bufPrint(buf, "‹" ++ config.pane_addr ++ "{d}", .{serial}) catch unreachable, // a u32 fits - .place => |at| std.fmt.bufPrint(buf, "{s}:{d}", .{ std.Io.Dir.path.basename(at.path.slice()), at.line }) catch unreachable, // a basename and a u32 fit + .place => |*at| place: { + const path = at.path.slice(); + var from = if (std.mem.lastIndexOfScalar(u8, path, '/')) |slash| slash + 1 else 0; + while (from > 0 and shared(t, i, path[from..])) from = if (std.mem.lastIndexOfScalar(u8, path[0 .. from - 1], '/')) |slash| slash + 1 else 0; + break :place std.fmt.bufPrint(buf, "{s}:{d}", .{ path[from..], at.line }) catch unreachable; // a path and a u32 fit + }, .list, .search, .recipe => |*w| w.text.slice(), }; } +/// Whether another step's file, not step `i`'s, has a path ending in `end` +/// at a `/`. +fn shared(t: *const Trail, i: usize, end: []const u8) bool { + const own = t.steps[i].place.path.slice(); + for (t.steps[0..t.n], 0..) |*s, j| { + if (j == i or s.* != .place) continue; + const path = s.place.path.slice(); + if (std.mem.eql(u8, path, own) or !std.mem.endsWith(u8, path, end)) continue; + if (path.len == end.len or path[path.len - end.len - 1] == '/') return true; + } + return false; +} + const sep = " › "; /// The steps a part writes. @@ -340,20 +358,36 @@ fn range(t: *const Trail, part: Part) [2]usize { }; } -/// Whether step `i` is in what `part` writes: out of rest the owner and -/// the newest back step only. -fn writes(t: *const Trail, part: Part, i: usize) bool { - return part != .newest or t.steps[i] == .owner or i + 1 == t.cur; +/// The forward steps written whole after the path at rest; the rest fold. +pub const shown_ahead = 2; + +/// Steps [lo, hi) of `part` folded into one dim `+N` word where the first +/// of them is (UX D8): at rest the back steps older than the newest +/// `whole` (never the owner), the forward steps past `shown_ahead`. +fn foldOf(t: *const Trail, part: Part, whole: usize) [2]usize { + return switch (part) { + .back => back: { + const lo: usize = @intFromBool(t.cur > 0 and t.steps[0] == .owner); + break :back .{ lo, @max(lo, t.cur -| whole) }; + }, + .forward => .{ @min(t.n, t.cur + 1 + shown_ahead), t.n }, + .newest => .{ 0, 0 }, + }; } /// The cells of the newest step's word out of rest: a longer one is cut /// in its middle (UX D1: `Find pick…3/6`). const newest_cells = 24; -/// Step `i`'s word as `part` writes it: out of rest a word longer than -/// `newest_cells` keeps its first and last cells around a `…`. -fn shownWord(t: *const Trail, part: Part, i: usize, whole: usize, buf: *[max_text + 16]u8, cut: *[max_text + 16]u8) []const u8 { - const word = wordOf(t, i, whole, buf); +/// Step `i`'s word as `part` writes it, null where it writes none: a +/// folded step's is the fold's `+N` on its first, none on the others; out +/// of rest the owner's and the newest step's alone, a word longer than +/// `newest_cells` keeping its first and last cells around a `…`. +fn wordIn(t: *const Trail, part: Part, whole: usize, i: usize, buf: *[max_text + 16]u8, cut: *[max_text + 16]u8) ?[]const u8 { + if (part == .newest and t.steps[i] != .owner and i + 1 != t.cur) return null; + const fold = foldOf(t, part, whole); + if (i >= fold[0] and i < fold[1]) return if (i == fold[0]) std.fmt.bufPrint(buf, "+{d}", .{fold[1] - fold[0]}) catch unreachable else null; + const word = wordOf(t, i, buf); if (part != .newest or word.len <= newest_cells) return word; const tab = 8; // a step's word holds no tab if (panes.File.displayWidth(tab, word) <= newest_cells) return word; @@ -364,15 +398,16 @@ fn shownWord(t: *const Trail, part: Part, i: usize, whole: usize, buf: *[max_tex } /// The back steps' words, each with the separator after it (before the -/// path), or the forward steps', each with one before it (after the path): -/// the newest `whole` back steps whole, older ones `·` (`folded`). +/// path), or the forward steps', each with one before it (after the path), +/// the folded ones as one `+N` (`foldOf`); out of rest (`newest`) the +/// owner's and the newest's. pub fn write(t: *const Trail, part: Part, whole: usize, w: *std.Io.Writer) std.Io.Writer.Error!void { var buf: [max_text + 16]u8 = undefined; var cut: [max_text + 16]u8 = undefined; const r = range(t, part); - for (r[0]..r[1]) |i| if (writes(t, part, i)) switch (part) { - .back, .newest => try w.print("{s}" ++ sep, .{shownWord(t, part, i, whole, &buf, &cut)}), - .forward => try w.print(sep ++ "{s}", .{wordOf(t, i, whole, &buf)}), + for (r[0]..r[1]) |i| if (wordIn(t, part, whole, i, &buf, &cut)) |word| switch (part) { + .back, .newest => try w.print("{s}" ++ sep, .{word}), + .forward => try w.print(sep ++ "{s}", .{word}), }; } @@ -382,12 +417,23 @@ pub fn bytes(t: *const Trail, part: Part, whole: usize) usize { var cut: [max_text + 16]u8 = undefined; var n: usize = 0; const r = range(t, part); - for (r[0]..r[1]) |i| if (writes(t, part, i)) { - n += shownWord(t, part, i, whole, &buf, &cut).len + sep.len; + for (r[0]..r[1]) |i| if (wordIn(t, part, whole, i, &buf, &cut)) |word| { + n += word.len + sep.len; }; return n; } +/// The back step `n` and N walk (Pick.walkList, Prompt): the newest list +/// or search; its word is underlined (UX D8). +pub fn walked(t: *const Trail) ?u8 { + var i: usize = t.cur; + while (i > 0) { + i -= 1; + if (t.steps[i] == .list or t.steps[i] == .search) return @intCast(i); + } + return null; +} + /// Whether pane `pane`'s tag is out of rest in the live view (UX D1: its /// path, its forward steps and its own words hidden, the owner and the /// newest step before the head). Asking is rest. @@ -396,13 +442,26 @@ pub fn outOfRest(p: *const Pardes, pane: *const Pane) bool { return p.panes[host] == pane; } -/// Where back step `i`'s word is in what `write` writes for the back -/// steps, the newest `whole` whole. +/// Where back step `i`'s word (the fold's `+N` for a folded one) is in +/// what `write` writes for the back steps, the newest `whole` whole. pub fn spanOf(t: *const Trail, i: usize, whole: usize) [2]usize { var buf: [max_text + 16]u8 = undefined; + var cut: [max_text + 16]u8 = undefined; var x: usize = 0; - for (0..i) |j| x += wordOf(t, j, whole, &buf).len + sep.len; - return .{ x, x + wordOf(t, i, whole, &buf).len }; + for (0..i) |j| if (wordIn(t, .back, whole, j, &buf, &cut)) |word| { + x += word.len + sep.len; + }; + const fold = foldOf(t, .back, whole); + const at = if (i >= fold[0] and i < fold[1]) fold[0] else i; + if (at < i) return spanOf(t, at, whole); + const word: []const u8 = wordIn(t, .back, whole, i, &buf, &cut) orelse ""; + return .{ x, x + word.len }; +} + +/// Whether back step `i` is in the fold's `+N`. +pub fn isFolded(t: *const Trail, i: usize, whole: usize) bool { + const fold = foldOf(t, .back, whole); + return i >= fold[0] and i < fold[1]; } /// The step whose word in `part` is at byte `off` of what `write` wrote @@ -412,12 +471,13 @@ pub fn stepAt(t: *const Trail, part: Part, whole: usize, off: usize) ?u8 { var cut: [max_text + 16]u8 = undefined; var x: usize = 0; const r = range(t, part); + const fold = foldOf(t, part, whole); for (r[0]..r[1]) |i| { - if (!writes(t, part, i)) continue; + const word = wordIn(t, part, whole, i, &buf, &cut) orelse continue; if (part == .forward) x += sep.len; - const n = shownWord(t, part, i, whole, &buf, &cut).len; - if (off >= x and off < x + n) return @intCast(i); - x += n; + // A fold's `+N` is the step nearest the path of those it holds. + if (off >= x and off < x + word.len) return @intCast(if (i == fold[0] and fold[0] < fold[1]) (if (part == .back) fold[1] - 1 else fold[0]) else i); + x += word.len; if (part != .forward) x += sep.len; } return null; @@ -761,19 +821,85 @@ test "the walk drawn with a picker's list and the notice row (walk UI G 2e, SPEC try std.testing.expect(std.mem.indexOf(u8, try tagOf(p, p.panes[rd].?), "› Refs 2/2 ›") != null); } -test "a trail keeps its newest three back steps whole, older ones fold to ·, and a click on a · goes back to its step" { +test "a trail keeps its newest three back steps whole, older ones fold into one dim `+N` after the owner, and a click on it goes back to the newest of them; forward steps past two fold the same way" { var f: Fixture = .{ .p = undefined, .tmp = undefined }; try f.init(60); defer f.deinit(); const p = f.p; const owner = p.panes[f.held].?.serial; - for ([_]usize{ 10, 20, 30, 40, 50 }) |line| f.look(f.held, "rank.zig", line); + for ([_]usize{ 10, 20, 30, 40, 50, 60 }) |line| f.look(f.held, "rank.zig", line); const r = p.view().active; + const pane = p.panes[r].?; + // Wide enough for the three newest whole on its one row. + p.update(.{ .resize = .{ .cols = 400, .rows = 60 } }); var buf: [4096 + 128]u8 = undefined; var at: [64]u8 = undefined; - try std.testing.expect(std.mem.startsWith(u8, try tagOf(p, p.panes[r].?), try std.fmt.bufPrint(&buf, "‹@p{d} › · › rank.zig:20 › rank.zig:30 › rank.zig:40 › {s}/rank.zig Keep ", .{ owner, f.dir }))); - try clickTag(p, r, "·", .right); + try std.testing.expect(std.mem.startsWith(u8, try tagOf(p, pane), try std.fmt.bufPrint(&buf, "‹@p{d} › +2 › rank.zig:30 › rank.zig:40 › rank.zig:50 › {s}/rank.zig Keep ", .{ owner, f.dir }))); + var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); + defer arena.deinit(); + const s = try p.render(arena.allocator()); + const fold = try tagCell(p, r, "+2"); + try std.testing.expectEqual(pardes.Color{ .rgb = p.chromeTheme().lineno }, s.at(fold[0], fold[1]).style.fg); + try clickTag(p, r, "+2", .right); + try std.testing.expectEqualStrings("rank.zig:20", f.at(&at)); + // Back at the first: five forward steps, the two nearest whole. + try clickTag(p, r, "rank.zig:10", .right); try std.testing.expectEqualStrings("rank.zig:10", f.at(&at)); + try std.testing.expect(std.mem.indexOf(u8, try tagOf(p, pane), try std.fmt.bufPrint(&buf, "{s}/rank.zig › rank.zig:20 › rank.zig:30 › +3 Keep ", .{f.dir})) != null); +} + +test "the walk never adds a row to a tag at rest: its steps fold further, down to the newest alone, where they would" { + var f: Fixture = .{ .p = undefined, .tmp = undefined }; + try f.init(60); + defer f.deinit(); + const p = f.p; + f.look(f.held, "rank.zig", 10); + for ([_]usize{ 20, 30, 40, 50, 60, 70 }) |line| { + f.look(p.view().active, "place.zig", line); + f.look(p.view().active, "rank.zig", line); + } + const r = p.view().active; + const pane = p.panes[r].?; + try std.testing.expect(pane.trail.cur > 4); + // A width 35 cells past what the tag takes with no walk: room on its + // row for the owner, a fold and the newest, not for three. + const walk = pane.trail; + pane.trail.n = 0; + pane.trail.cur = 0; + const bare = panes.File.displayWidth(p.settings.tab, try tagOf(p, pane)); + pane.trail = walk; + const extra = p.view().screen_w - pardes.tagline.tagWidth(p, r); + p.update(.{ .resize = .{ .cols = @intCast(bare + 35 + extra), .rows = 60 } }); + p.sync(); + try std.testing.expectEqual(@as(u16, 1), pardes.layout.wantedTagRows(p, r)); + try std.testing.expect(std.mem.indexOf(u8, try tagOf(p, pane), " › +") != null); +} + +test "two steps whose files have the same name are told apart by the shortest path they do not share; the word n walks is underlined" { + var f: Fixture = .{ .p = undefined, .tmp = undefined }; + try f.init(60); + defer f.deinit(); + const p = f.p; + try f.tmp.dir.createDirPath(std.testing.io, "core"); + try f.tmp.dir.writeFile(std.testing.io, .{ .sub_path = "core/rank.zig", .data = "a\nb\nc\n" }); + f.look(f.held, "rank.zig", 12); + f.look(p.view().active, "core/rank.zig", 2); + f.look(p.view().active, "place.zig", 3); + const r = p.view().active; + var buf: [4096 + 128]u8 = undefined; + const tag = try tagOf(p, p.panes[r].?); + try std.testing.expect(std.mem.indexOf(u8, tag, try std.fmt.bufPrint(&buf, " › {s}/rank.zig:12 › core/rank.zig:2 › ", .{std.Io.Dir.path.basename(f.dir)})) != null); + // A list word: the one n walks, underlined. + p.panes[r].?.trail.steps[1] = .{ .list = .{} }; + p.panes[r].?.trail.steps[1].list.text.set("Find x 1/2"); + p.sync(); + var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); + defer arena.deinit(); + const s = try p.render(arena.allocator()); + const word = try tagCell(p, r, "Find x 1/2"); + try std.testing.expect(s.at(word[0], word[1]).style.ul == .single); + const other = try tagCell(p, r, "place.zig"); + try std.testing.expect(s.at(other[0], other[1]).style.ul != .single); } test "Ctrl-o goes back one place in a reader's walk and Ctrl-i forward again; past its first place, or from a held pane, the jump list's" { diff --git a/core/draw.zig b/core/draw.zig index be4230c4..28b9f22d 100644 --- a/core/draw.zig +++ b/core/draw.zig @@ -695,7 +695,7 @@ fn tagTintRange(p: *const Pardes, pane: *const Pane, tag: []const u8, prefix_len } return null; } - var start: usize = tagline.nameAt(pane); + var start: usize = tagline.nameAt(p, pane); const name = if (pane.file) |file| if (pane.prompt == .name) pane.input.own orelse file.path else file.path else if (pane.addon) |k| blk: { @@ -945,7 +945,7 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R /// Bytes `lo` to `hi` of a tag's text in `ink`, over whichever of its /// shown rows (`lines`, from shown row `top`, drawn at `x`, `y`, `w` /// wide) they wrapped onto. -fn inkTag(p: *Pardes, s: *Surface, shown: tagline.Shown, lines: []const []const u8, top: usize, x: u16, y: u16, w: u16, lo: usize, hi: usize, ink: [3]u8) void { +fn inkTag(p: *Pardes, s: *Surface, shown: tagline.Shown, lines: []const []const u8, top: usize, x: u16, y: u16, w: u16, lo: usize, hi: usize, ink: [3]u8, under: bool) void { const a = modal.positionAt(shown.text, shown.fromReal(lo)); const b = modal.positionAt(shown.text, shown.fromReal(hi)); var row = @max(a.row, top); @@ -956,8 +956,11 @@ fn inkTag(p: *Pardes, s: *Surface, shown: tagline.Shown, lines: []const []const var col = panes.File.rawDisplayCol(p.settings.tab, line, @min(from, line.len)); const end = panes.File.rawDisplayCol(p.settings.tab, line, @min(to, line.len)); const row_y = y + @as(u16, @intCast(row - top)); - while (col < end and col < w) : (col += 1) - s.at(x + @as(u16, @intCast(col)), row_y).style.fg = .{ .rgb = ink }; + while (col < end and col < w) : (col += 1) { + const style = &s.at(x + @as(u16, @intCast(col)), row_y).style; + style.fg = .{ .rgb = ink }; + if (under) style.ul = .single; + } } } @@ -1014,7 +1017,7 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, else if (pane.prompt == .name) caret: { // A drafted name is the prefix: its caret is on row 0 of the tag, // the rows it wrapped onto included. - const at = modal.positionAt(shown.text, shown.fromReal(tagline.nameAt(pane) + @as(usize, @intCast(@max(0, pane.input.cur_col))))); + const at = modal.positionAt(shown.text, shown.fromReal(tagline.nameAt(p, pane) + @as(usize, @intCast(@max(0, pane.input.cur_col))))); if (at.row < top or at.row >= top + rows) break :caret null; break :caret .{ .row = at.row - top, .at = @min(lines[at.row - top].len, at.col) }; } else if (pane.focus == .tag and pane.prompt == .none and head == null) caret: { @@ -1059,12 +1062,26 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, // wrapped onto. const first_line = whole[0 .. std.mem.indexOfScalar(u8, whole, '\n') orelse whole.len]; if (tagTintRange(p, pane, first_line, prefix_len)) |name| if (name.lo < name.hi) - inkTag(p, s, shown, lines[0..rows], top, tx, tag_y, tw, name.lo, @min(name.hi, first_line.len), if (active) chrome.tag_active_name_fg else chrome.tag_name_fg); - // A walk's forward steps, after the name, dimmed (Trail.zig). + inkTag(p, s, shown, lines[0..rows], top, tx, tag_y, tw, name.lo, @min(name.hi, first_line.len), if (active) chrome.tag_active_name_fg else chrome.tag_name_fg, false); + // A walk's forward steps, after the name, dimmed (Trail.zig); its fold + // `+N` too; the word n walks underlined in the key ink (UX D8). const ahead = tagline.forwardSpan(p, pane); - if (ahead[0] < ahead[1]) inkTag(p, s, shown, lines[0..rows], top, tx, tag_y, tw, ahead[0], @min(ahead[1], first_line.len), chrome.lineno); + if (ahead[0] < ahead[1]) inkTag(p, s, shown, lines[0..rows], top, tx, tag_y, tw, ahead[0], @min(ahead[1], first_line.len), chrome.lineno, false); + if (pane.file != null and pane.trail.n > 0 and !pardes.Trail.outOfRest(p, pane)) { + const kept = tagline.folded(p, pane); + const t = &pane.trail; + const first: usize = @intFromBool(t.steps[0] == .owner); + if (t.isFolded(first, kept)) { + const fold = t.spanOf(first, kept); + inkTag(p, s, shown, lines[0..rows], top, tx, tag_y, tw, fold[0], @min(fold[1], first_line.len), chrome.lineno, false); + } + if (t.walked()) |i| if (!t.isFolded(i, kept)) { + const word = t.spanOf(i, kept); + inkTag(p, s, shown, lines[0..rows], top, tx, tag_y, tw, word[0], @min(word[1], first_line.len), chrome.box, true); // P2: the key role + }; + } // A search word its places no longer light, dimmed (Prompt.zig). - if (pardes.Prompt.unlit(p, pane)) |span| inkTag(p, s, shown, lines[0..rows], top, tx, tag_y, tw, span[0], @min(span[1], first_line.len), chrome.lineno); + if (pardes.Prompt.unlit(p, pane)) |span| inkTag(p, s, shown, lines[0..rows], top, tx, tag_y, tw, span[0], @min(span[1], first_line.len), chrome.lineno, false); // The head's keys in the key ink, its dimmed, underlined and struck // words (TagState.Span), over whichever rows they wrapped onto. if (head) |h| for (h.spans) |span| { diff --git a/core/tagline.zig b/core/tagline.zig index 3256f824..5f7222e6 100644 --- a/core/tagline.zig +++ b/core/tagline.zig @@ -179,7 +179,7 @@ fn restPath(p: *const Pardes, arena: std.mem.Allocator, pane: *Pane) ![]const u8 // Its walk's back steps before the name, its forward steps after // it (Trail.zig), in the room `bytes` measures them. const keep_word = if (keep) " Keep" else ""; - const whole = pardes.Trail.shown_steps; + const whole = folded(p, pane); const room = try arena.alloc(u8, pane.trail.bytes(.back, whole) + name.len + pane.trail.bytes(.forward, whole) + keep_word.len); var w: std.Io.Writer = .fixed(room); pane.trail.write(.back, whole, &w) catch return error.OutOfMemory; @@ -200,15 +200,48 @@ fn restPath(p: *const Pardes, arena: std.mem.Allocator, pane: *Pane) ![]const u8 } /// Where a file's name starts in its tag: after its walk's back steps. -pub fn nameAt(pane: *const Pane) usize { - return if (pane.file != null and pane.trail.n > 0) pane.trail.bytes(.back, pardes.Trail.shown_steps) else 0; +pub fn nameAt(p: *const Pardes, pane: *const Pane) usize { + return if (pane.file != null and pane.trail.n > 0) pane.trail.bytes(.back, folded(p, pane)) else 0; +} + +/// The back steps a file's tag writes whole at rest (UX D8): the newest +/// three (Trail.shown_steps), fewer, down to the newest alone, while its +/// walk would make the tag take more rows than it takes with none: the +/// walk never adds a row to a tag at rest (as far as the newest alone +/// lets it). +pub fn folded(p: *const Pardes, pane: *const Pane) usize { + const t = &pane.trail; + const f = pane.file orelse return pardes.Trail.shown_steps; + if (t.n == 0) return pardes.Trail.shown_steps; + const id = panes.paneIdOf(p, pane) orelse return pardes.Trail.shown_steps; + const tab = p.settings.tab; + const width = tagWidth(p, id); + const name = if (pane.prompt == .name) pane.input.own orelse f.path else f.path; + const bare = panes.File.displayWidth(tab, name) + @as(usize, if (pardes.Trail.reading(p, pane)) " Keep".len else 0) + panes.File.displayWidth(tab, curTail(pane)); + var whole: usize = pardes.Trail.shown_steps; + while (whole > 1 and rowsOf(bare + walkCells(t, whole, tab), width) > rowsOf(bare, width)) whole -= 1; + return whole; +} + +/// The cells a walk's words take at rest with its newest `whole` back +/// steps whole. +fn walkCells(t: *const pardes.Trail, whole: usize, tab: u16) usize { + var room: [pardes.Trail.max_steps * (pardes.Trail.max_text + 32)]u8 = undefined; + var w: std.Io.Writer = .fixed(&room); + t.write(.back, whole, &w) catch {}; + t.write(.forward, whole, &w) catch {}; + return panes.File.displayWidth(tab, w.buffered()); +} + +fn rowsOf(cells: usize, width: usize) usize { + return @max(1, (cells + width - 1) / width); } /// The bytes of a file's tag its walk's forward steps take, after its name. pub fn forwardSpan(p: *const Pardes, pane: *const Pane) [2]usize { const f = pane.file orelse return .{ 0, 0 }; if (pane.trail.n == 0 or pardes.Trail.outOfRest(p, pane)) return .{ 0, 0 }; - const whole = pardes.Trail.shown_steps; + const whole = folded(p, pane); const name = if (pane.prompt == .name) pane.input.own orelse f.path else f.path; const lo = pane.trail.bytes(.back, whole) + name.len; return .{ lo, lo + pane.trail.bytes(.forward, whole) }; @@ -219,9 +252,9 @@ pub fn forwardSpan(p: *const Pardes, pane: *const Pane) [2]usize { pub fn trailAt(p: *const Pardes, pane: *const Pane, at: usize) ?u8 { if (pane.trail.n == 0 or pane.file == null) return null; if (pardes.Trail.outOfRest(p, pane)) return pane.trail.stepAt(.newest, 1, at); - const whole = pardes.Trail.shown_steps; + const whole = folded(p, pane); const ahead = forwardSpan(p, pane); - if (at < nameAt(pane)) return pane.trail.stepAt(.back, whole, at); + if (at < nameAt(p, pane)) return pane.trail.stepAt(.back, whole, at); if (at >= ahead[0] and at < ahead[1]) return pane.trail.stepAt(.forward, whole, at - ahead[0]); return null; } @@ -268,7 +301,7 @@ pub fn restPrefix(p: *const Pardes, arena: std.mem.Allocator, pane: *Pane) ![]u8 /// The tag's own text: what the user made of it, or until then the /// default a pane of its kind starts with. -pub fn curTail(pane: *Pane) []const u8 { +pub fn curTail(pane: *const Pane) []const u8 { return pane.tag.own orelse defaultTail(pane); } @@ -444,7 +477,7 @@ pub fn onName(p: *const Pardes, pane: *Pane, row: usize, col: usize) ?usize { const name = if (pane.prompt == .name) pane.input.own orelse f.path else f.path; var room: [pardes.Trail.max_steps * (pardes.Trail.max_text + 32)]u8 = undefined; var w: std.Io.Writer = .fixed(&room); - pane.trail.write(.back, pardes.Trail.shown_steps, &w) catch return null; + pane.trail.write(.back, folded(p, pane), &w) catch return null; const lead = panes.File.displayWidth(tab, w.buffered()); if (col < lead or col >= lead + panes.File.displayWidth(tab, name)) return null; return col - lead; @@ -459,8 +492,8 @@ pub fn typedIntoName(p: *Pardes, pane: *Pane, key: pardes.Key) bool { if (!panes.Output.fileTraits(f.output).saves or pane.tag.cur_row != 0) return false; // The name starts after its walk's words. const col: usize = @intCast(@max(0, pane.tag.cur_col)); - if (col < nameAt(pane)) return false; - const at = col - nameAt(pane); + if (col < nameAt(p, pane)) return false; + const at = col - nameAt(p, pane); const back = key.cp == pardes.Key.backspace or pardes.hit(key, config.insert_backspace_alias); const forward = key.cp == pardes.Key.delete or pardes.hit(key, config.insert_delete_alias); const typed = key.text.len > 0 and !key.ctrl and !key.alt; diff --git a/test/snapshots/fsearch.golden b/test/snapshots/fsearch.golden index 59037755..627fb21c 100644 --- a/test/snapshots/fsearch.golden +++ b/test/snapshots/fsearch.golden @@ -97,8 +97,8 @@ |28: 8 l8 |29: 9 l9 == 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 +|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ‹@p1 › +1 › /MARK/ 2/3 › /tmp/pardes-snap/fsearch/cwd/g.txt Keep Save Term Collapse Foll +|17: ls ow Del |18: g.txt 2 MARK a |19: 3 l3 |20: 4 l4 @@ -112,7 +112,7 @@ |28: 12 l12 |29: == snap n grid=180x31 cursor=97,27 -|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ‹@p1 › g.txt:1 › /MARK/ 3/3 › /tmp/pardes-snap/fsearch/cwd/g.txt Keep Save Term Collapse +|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ‹@p1 › +1 › /MARK/ 3/3 › /tmp/pardes-snap/fsearch/cwd/g.txt Keep Save Term Collapse Foll |18: g.txt 1 l1 |19: 2 MARK a |20: 3 l3 @@ -126,7 +126,7 @@ |28: 11 l11 |29: 12 l12 == snap N grid=180x31 cursor=97,23 -|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 +|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ‹@p1 › +1 › /MARK/ 2/3 › /tmp/pardes-snap/fsearch/cwd/g.txt Keep Save Term Collapse Foll == 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 · esc diff --git a/test/snapshots/lookrange.golden b/test/snapshots/lookrange.golden index a0cbd3be..1ea85a6e 100644 --- a/test/snapshots/lookrange.golden +++ b/test/snapshots/lookrange.golden @@ -100,7 +100,7 @@ |7: /NEEDLE/ 2/2 › /tmp/pardes-snap/lookrange/cwd/r.txt Save Term Collapse Follow Del |30: /tmp/pardes-snap/lookrange/cwd/r.txt:8 == style hit1 grid=150x31 -|7: 0-1 d,#add38a, 2-47 #becfc4,#314738, 48-53 #dfbce5,#314738, 54-149 #becfc4,#314738, +|7: 0-1 d,#add38a, 2-13 #add38a,#314738,u 14-14 #add38a,#314738, 15-47 #becfc4,#314738, 48-53 #dfbce5,#314738, 54-149 #becfc4,#314738, |14: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-9 #e5eee5,#0d1410, 10-15 #e5eee5,#352e19, 16-149 #e5eee5,#0d1410, |15: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-11 #e5eee5,#0d1410, 12-17 #f5f7ee,#3c614a, 18-149 #f5f7ee,#0d1410, |16: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-149 #e5eee5,#0d1410, @@ -110,7 +110,7 @@ |7: /NEEDLE/ 1/2 ↻ › /tmp/pardes-snap/lookrange/cwd/r.txt Save Term Collapse Follow Del |30: · /tmp/pardes-snap/lookrange/cwd/r.txt /NEEDLE/ 1/2 ↻ · line 7 1 message · SPC h m == style hit2 grid=150x31 -|7: 0-1 d,#add38a, 2-49 #becfc4,#314738, 50-55 #dfbce5,#314738, 56-149 #becfc4,#314738, +|7: 0-1 d,#add38a, 2-15 #add38a,#314738,u 16-16 #add38a,#314738, 17-49 #becfc4,#314738, 50-55 #dfbce5,#314738, 56-149 #becfc4,#314738, |14: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-9 #e5eee5,#0d1410, 10-15 #f5f7ee,#3c614a, 16-16 #f5f7ee,#0d1410, 17-149 #e5eee5,#0d1410, |15: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-11 #e5eee5,#0d1410, 12-17 #e5eee5,#352e19, 18-149 #e5eee5,#0d1410, |22: 0-0 d,#e5eee5, 1-149 d,#0d1410, -- cgit v1.3