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 --- test/behaviour/keys.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'test/behaviour') diff --git a/test/behaviour/keys.zig b/test/behaviour/keys.zig index 6a62ccd7..65c52ee7 100644 --- a/test/behaviour/keys.zig +++ b/test/behaviour/keys.zig @@ -25,11 +25,12 @@ test "keys: a prompt's entry and cancellation leave the tag, the body and its cu try s.write(dot, "6 6"); try s.keys(case.keys); // The answer is typed into the tag's head (walk UI), shown in place - // of the tag's own text, which it never touches. + // of the tag's own text, which it never touches; out of rest the + // path is hidden too (UX D1): the head starts the tag. try s.keys("zq"); _ = try s.where(case.shown); const head = try s.read(tag); - try std.testing.expect(std.mem.startsWith(u8, head, "/test.txt") and std.mem.startsWith(u8, head["/test.txt".len..], case.shown)); + try std.testing.expect(std.mem.startsWith(u8, head, case.shown[1..])); try s.keys("\x1b"); try std.testing.expectError(error.NotOnScreen, s.where(case.shown)); try std.testing.expect(std.mem.endsWith(u8, try s.read(s.at("/pane/{d}/ctl", .{n})), " mode:normal ")); -- cgit v1.3 From c3b01a651dcee194f20a5be8da80a3f55a7235e7 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 25 Nov 2026 05:17:46 -0300 Subject: bindings, TagState, Messages: nothing changes in the tag before a root's level shows, its keys echo on the notice row's right end at once (walk UI polish P1, UX DESIGN.md D12, C2): SPC, `"` and C-w wrote their key cell into the tag at once (`at_once`), which with D1 (the path hidden out of rest) flipped the whole tag and back at every fast chord (`SPC j o`, `SPC f s`: a flash per chord, UX A16); now the tag stays exactly at rest until the root's delay passes (SPC and C-w 250 ms, `"` 300 ms, g m z [ ] Z 500 ms, on the taped clock), a sequence finished inside the delay never touches it (the spec's `gg` rule, extended to SPC), and after the delay it goes straight to D1's layout in one frame; the keys typed so far show at once at the notice row's right end (`SPC f`, vim's showcmd): TagState.pending gives the chord (bindings.chord) while a root is current and its level not shown, Messages.noticeRow appends it to the row's right part; THE CHANGE: bindings.Info's `at_once` is deleted (every root waits), TagState.hostOf is null until `shown`, and head's `…` branch for a key cell alone is gone (unreachable); TEST FIRST: TagState.zig "SPC changes nothing in the tag until its level shows 250 ms on, its keys on the notice row's right end at once ..." (on the base the tag is `␣ …` after SPC: fails), bindings.zig's registers test (`"`: the tag as at rest until 300 ms), the C-w test, "a tag out of rest keeps its rows at rest at least" (now Help's head under the rows the tag keeps: there is no key-cell-alone state left), the click and the asking tests date the level before they read it; test/behaviour keys.zig's PDF case: SPC leaves the panes as they were and the notice row ends `SPC`; core-test 1062/1232 (170 skipped); behaviour-test 277/277; process-test 0/146 failed (no golden caught the key cell alone); a user saw the flash at every leader chord 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/Messages.zig | 10 ++++++++-- core/TagState.zig | 47 +++++++++++++++++++++++++++++++---------------- core/bindings.zig | 30 +++++++++++++++--------------- test/behaviour/keys.zig | 11 ++++++++--- 4 files changed, 62 insertions(+), 36 deletions(-) (limited to 'test/behaviour') diff --git a/core/Messages.zig b/core/Messages.zig index 2b63e647..dd5c232a 100644 --- a/core/Messages.zig +++ b/core/Messages.zig @@ -726,6 +726,10 @@ pub fn noticeRow(p: *const Pardes, width: usize, out: *[notice_row_cap]u8) Row { r.writeAll("SPC e walk") catch {} else if (m.len > 0) r.print("{d} message{s} \u{b7} SPC h m", .{ m.len, if (m.len == 1) "" else "s" }) catch {}; + // The keys of a root whose level waits for its delay, at once (UX D12: + // vim's showcmd; the tag stays at rest until the level shows). + var keys: [64]u8 = undefined; + if (pardes.TagState.pending(p, p.view(), &keys)) |typed| r.print("{s}{s}", .{ if (r.end > 0) " " else "", typed }) catch {}; const tail = r.buffered(); // The left cut to make room for the right, a blank between them. const tail_w = panes.File.displayWidth(tab, tail); @@ -1362,9 +1366,11 @@ test "a file changed on disk under unsaved text asks in its tag and never takes try std.testing.expect(std.mem.indexOf(u8, prefix, "changed on disk") == null); // The tag's own text is no one's to edit meanwhile. try std.testing.expect((try pardes.TagState.head(p, frame.allocator(), pane)) != null); - // Out of rest (SPC: its key cell at once) the level's head, not the - // question; at rest again, the question. + // Out of rest (SPC's level shown) the level's head, not the question; + // at rest again, the question. p.update(.{ .key = .{ .cp = ' ' } }); + p.advance(p.clock.now_ns); + p.clock.now_ns = p.view().tag_state.due_ns; try std.testing.expect(std.mem.indexOf(u8, try pardes.tagline.tagText(p, frame.allocator(), pane), "changed on disk") == null); p.update(.{ .key = .{ .cp = Key.escape } }); try std.testing.expect(std.mem.indexOf(u8, try pardes.tagline.tagText(p, frame.allocator(), pane), "changed on disk") != null); diff --git a/core/TagState.zig b/core/TagState.zig index 8bead506..96c5b9b1 100644 --- a/core/TagState.zig +++ b/core/TagState.zig @@ -26,6 +26,7 @@ const Band = @import("Band.zig"); const Names = @import("Names.zig"); const Prompt = @import("Prompt.zig"); const Ask = @import("lsp/Ask.zig"); +const Messages = @import("Messages.zig"); /// The tag's states besides a root's level (which `kind` rest with a root /// current is): `help`, a field over every leaf (SPEC §4.5); `describe`, @@ -192,8 +193,7 @@ pub fn hostOf(p: *const Pardes) ?usize { if (v.tag_state.kind != .rest) return for (p.panes, 0..) |slot, i| { if (slot) |pane| if (pane.serial == v.tag_state.host) break i; } else null; - const cur = current(p, v) orelse return null; - if (!bindings.info.get(cur.root).at_once and !shown(p, v)) return null; + if (current(p, v) == null or !shown(p, v)) return null; return if (p.panes[v.active] != null) v.active else null; } @@ -311,6 +311,15 @@ fn asking(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?Head { return b.done(); } +/// The keys of the root current in view `v` while its level waits for its +/// delay (UX D12: the tag is at rest until then), as the notice row's right +/// end echoes them at once: `SPC f`. +pub fn pending(p: *const Pardes, v: *const View, buf: []u8) ?[]const u8 { + if (v.tag_state.kind != .rest or shown(p, v)) return null; + const cur = current(p, v) orelse return null; + return bindings.chord(cur.root, cur.path, buf); +} + /// The last leaf run in the current level, as the line under it says it /// (Messages' leader band): `k Hover: its summary (last used here)`, while /// the level is shown rolled. @@ -557,10 +566,6 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?Head { } const cur = current(p, v) orelse return null; try b.keyCells(cur.root, cur.path); - if (!shown(p, v)) { - try b.put("…"); - return b.done(); - } 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); @@ -614,7 +619,7 @@ fn testTag(p: *Pardes, arena: std.mem.Allocator) ![]const u8 { return tagline.tagText(p, arena, p.panes[p.view().active].?); } -test "SPC writes its key cell at once and its level 250 ms on; g changes nothing until 500 ms, and gg never" { +test "SPC changes nothing in the tag until its level shows 250 ms on, its keys on the notice row's right end at once; g nothing until 500 ms, and gg never" { const Key = pardes.Key; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 30 }); defer p.deinit(); @@ -626,9 +631,12 @@ test "SPC writes its key cell at once and its level 250 ms on; g changes nothing p.clock.stepped_ns = p.clock.now_ns; p.sync(); const rest = try a.dupe(u8, try testTag(p, a)); - // SPC: its cell at once, the own words gone under the head. + // SPC: the tag at rest until the level shows (UX D12), the keys typed + // at the notice row's right end at once. p.update(.{ .key = .{ .cp = ' ' } }); - try std.testing.expect(std.mem.eql(u8, try testTag(p, a), "␣ …")); + try std.testing.expectEqualStrings(rest, try testTag(p, a)); + var row: [Messages.notice_row_cap]u8 = undefined; + try std.testing.expect(std.mem.endsWith(u8, Messages.noticeRow(p, 100, &row).text, "SPC")); // Its time is the next advance's; the level waits 250 ms from it, and // the loop wakes for it then. try std.testing.expectEqual(asked, p.view().tag_state.due_ns); @@ -638,7 +646,7 @@ test "SPC writes its key cell at once and its level 250 ms on; g changes nothing const woken = p.nextWake().?; try std.testing.expect(woken >= due and woken < due + pardes.frame_ns); p.clock.now_ns = due - 1; - try std.testing.expect(std.mem.eql(u8, try testTag(p, a), "␣ …")); + try std.testing.expectEqualStrings(rest, try testTag(p, a)); p.clock.now_ns = due; const level = try testTag(p, a); try std.testing.expect(std.mem.indexOf(u8, level, "␣ ▸ b buffer…") != null); @@ -846,9 +854,10 @@ test "C-w's level is window mode's, shown at once and kept while its keys move t var frame = std.heap.ArenaAllocator.init(std.testing.allocator); defer frame.deinit(); const a = frame.allocator(); + const rest = try a.dupe(u8, try testTag(p, a)); p.update(.{ .key = .{ .cp = 'w', .ctrl = true } }); try std.testing.expect(p.view().window_pick != null); - try std.testing.expect(std.mem.endsWith(u8, try testTag(p, a), "C-w …")); + try std.testing.expectEqualStrings(rest, try testTag(p, a)); p.advance(p.clock.now_ns); p.clock.now_ns = p.view().tag_state.due_ns; try std.testing.expect(std.mem.indexOf(u8, try testTag(p, a), "C-w ▸ c Collapse d Del h Left j Down k Up l Right") != null); @@ -953,7 +962,7 @@ test "a terminal's rolled level keeps its tag rows at every width, C-w's as SPC' }; } -test "a tag out of rest keeps its rows at rest at least: a root's key cell alone moves no body up" { +test "a tag out of rest keeps its rows at rest at least: a level shorter than its own text moves no body up" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 30 }); defer p.deinit(); _ = try p.setTestFile("one\n"); @@ -961,19 +970,23 @@ test "a tag out of rest keeps its rows at rest at least: a root's key cell alone p.sync(); const rows, const tag_rows = .{ pane.rows, pane.tag_rows }; try std.testing.expect(tag_rows > 1); + // Help's head, a row, its band under the rows the tag keeps. p.update(.{ .key = .{ .cp = ' ' } }); + p.update(.{ .key = .{ .cp = '?' } }); p.sync(); try std.testing.expect(hostOf(p) != null); - try std.testing.expectEqual(tag_rows, pane.tag_rows); - try std.testing.expectEqual(rows, pane.rows); + try std.testing.expectEqual(tag_rows, pane.tag_rows - pane.band_rows); + try std.testing.expectEqual(rows, pane.rows + pane.band_rows); // With the keyboard in the tag (whose top row follows its caret) too: - // C-w's key cell, a line, in a tag of more rows. + // C-w's level, a line, in a tag of more rows. toRest(p); pane.focus = .tag; p.update(.{ .key = .{ .cp = 'w', .ctrl = true } }); + p.advance(p.clock.now_ns); + p.clock.now_ns = p.view().tag_state.due_ns; p.sync(); try std.testing.expect(hostOf(p) != null); - try std.testing.expectEqual(tag_rows, pane.tag_rows); + try std.testing.expect(pane.tag_rows >= tag_rows); try std.testing.expectEqual(@as(u16, 0), pane.tag_top); } @@ -1024,6 +1037,8 @@ test "a click that gives the keyboard to another pane ends a level as Esc does; const rl = p.view().rects[low]; // SPC's level in the lower pane's tag; a click in its own tag keeps it. p.update(.{ .key = .{ .cp = ' ' } }); + p.advance(p.clock.now_ns); + p.clock.now_ns = p.view().tag_state.due_ns; try std.testing.expect(hostOf(p) == low); click(p, rl.x + config.GUTTER + 2, rl.y); try std.testing.expect(hostOf(p) == low and p.view().prefix == .leader); diff --git a/core/bindings.zig b/core/bindings.zig index 43145b15..af5e8a6d 100644 --- a/core/bindings.zig +++ b/core/bindings.zig @@ -45,26 +45,25 @@ pub const Info = struct { /// Its key cell in the head (`␣` for SPC). cell: []const u8, label: []const u8, - /// How long after it the level shows (SPEC §3.3). + /// How long after it the level shows (SPEC §3.3): the tag changes + /// nothing before (UX D12), so `gg` and a fast `SPC f s` never touch it; + /// its keys show on the notice row's right end at once (Messages). delay_ns: u64, - /// Its key cell is written at once (SPC, `"`, `C-w`); the others change - /// nothing until the delay is up, so `gg` never touches the tag. - at_once: bool, node: *const Node, }; const ms = std.time.ns_per_ms; pub const info = std.EnumArray(Root, Info).init(.{ - .leader = .{ .key = .{ .cp = config.leader[0].cp }, .cell = "␣", .label = "SPC", .delay_ns = 250 * ms, .at_once = true, .node = &leader_tree }, - .window = .{ .key = .{ .cp = config.window_prefix[0].cp, .ctrl = true }, .cell = "C-w", .label = "window", .delay_ns = 250 * ms, .at_once = true, .node = &window_tree }, - .goto = .{ .key = .{ .cp = config.goto_prefix }, .cell = "g", .label = "goto", .delay_ns = 500 * ms, .at_once = false, .node = &goto_tree }, - .match = .{ .key = .{ .cp = config.match_prefix }, .cell = "m", .label = "match", .delay_ns = 500 * ms, .at_once = false, .node = &match_tree }, - .view = .{ .key = .{ .cp = config.view_prefix }, .cell = "z", .label = "view", .delay_ns = 500 * ms, .at_once = false, .node = &view_tree }, - .view_sticky = .{ .key = .{ .cp = config.view_prefix_sticky }, .cell = "Z", .label = "view", .delay_ns = 500 * ms, .at_once = false, .node = &view_sticky_tree }, - .prev = .{ .key = .{ .cp = config.prev_prefix }, .cell = "[", .label = "previous", .delay_ns = 500 * ms, .at_once = false, .node = &prev_tree }, - .next = .{ .key = .{ .cp = config.next_prefix }, .cell = "]", .label = "next", .delay_ns = 500 * ms, .at_once = false, .node = &next_tree }, - .register = .{ .key = .{ .cp = config.register_prefix }, .cell = "\"", .label = "registers", .delay_ns = 300 * ms, .at_once = true, .node = ®ister_tree }, + .leader = .{ .key = .{ .cp = config.leader[0].cp }, .cell = "␣", .label = "SPC", .delay_ns = 250 * ms, .node = &leader_tree }, + .window = .{ .key = .{ .cp = config.window_prefix[0].cp, .ctrl = true }, .cell = "C-w", .label = "window", .delay_ns = 250 * ms, .node = &window_tree }, + .goto = .{ .key = .{ .cp = config.goto_prefix }, .cell = "g", .label = "goto", .delay_ns = 500 * ms, .node = &goto_tree }, + .match = .{ .key = .{ .cp = config.match_prefix }, .cell = "m", .label = "match", .delay_ns = 500 * ms, .node = &match_tree }, + .view = .{ .key = .{ .cp = config.view_prefix }, .cell = "z", .label = "view", .delay_ns = 500 * ms, .node = &view_tree }, + .view_sticky = .{ .key = .{ .cp = config.view_prefix_sticky }, .cell = "Z", .label = "view", .delay_ns = 500 * ms, .node = &view_sticky_tree }, + .prev = .{ .key = .{ .cp = config.prev_prefix }, .cell = "[", .label = "previous", .delay_ns = 500 * ms, .node = &prev_tree }, + .next = .{ .key = .{ .cp = config.next_prefix }, .cell = "]", .label = "next", .delay_ns = 500 * ms, .node = &next_tree }, + .register = .{ .key = .{ .cp = config.register_prefix }, .cell = "\"", .label = "registers", .delay_ns = 300 * ms, .node = ®ister_tree }, }); /// SPC's groups by their key, as the spec names them (Appendix A). @@ -566,9 +565,10 @@ test "\" shows the registers rolled, each its first line; Down unrolls them besi p.clock.now_ns = 5 * std.time.ns_per_s; p.clock.stepped_ns = p.clock.now_ns; p.sync(); - // Its key cell at once, the level 300 ms on. + // Nothing in the tag until the level shows 300 ms on (UX D12). + const rest = try a.dupe(u8, try tagline.tagText(p, a, pane)); p.update(.{ .key = .{ .cp = '"' } }); - try std.testing.expect(std.mem.endsWith(u8, try tagline.tagText(p, a, pane), "\" …")); + try std.testing.expectEqualStrings(rest, try tagline.tagText(p, a, pane)); p.advance(p.clock.now_ns); try std.testing.expectEqual(p.clock.now_ns + 300 * std.time.ns_per_ms, p.view().tag_state.due_ns); p.clock.now_ns = p.view().tag_state.due_ns; diff --git a/test/behaviour/keys.zig b/test/behaviour/keys.zig index 65c52ee7..6256a0b7 100644 --- a/test/behaviour/keys.zig +++ b/test/behaviour/keys.zig @@ -388,12 +388,17 @@ test "keys: a PDF in normal mode keeps : (its tag and back), SPC (a leader, canc try std.testing.expect(std.mem.endsWith(u8, try s.read(s.at("/pane/{d}/ctl", .{n})), " mode:normal ")); try s.keys(":"); try std.testing.expect(try s.cursor() == null); - // The leader shows its key cell in the tag at once (walk UI) until a + // The leader changes nothing in the tag before its level shows (walk + // UI, UX D12): its key on the notice row's right end at once, until a // key the PDF takes, which takes the leader away. + const before = try std.testing.allocator.dupe(u8, try panesShown(&s)); + defer std.testing.allocator.free(before); try s.keys(" "); - try std.testing.expect(std.mem.indexOf(u8, try panesShown(&s), " ␣ ") != null); + try std.testing.expectEqualStrings(before, try panesShown(&s)); + const shown = try s.screen(); + try std.testing.expect(std.mem.endsWith(u8, std.mem.trimEnd(u8, shown[std.mem.lastIndexOfScalar(u8, shown, '\n').? + 1 ..], " "), "SPC")); try s.keys("!"); - try std.testing.expect(std.mem.indexOf(u8, try panesShown(&s), " ␣ ") == null); + try std.testing.expectEqualStrings(before, try panesShown(&s)); try s.keys("/"); try std.testing.expect(try s.cursor() != null); try std.testing.expectEqual(n, try s.focused()); -- cgit v1.3