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 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'core/Messages.zig') 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); -- cgit v1.3 From 6068e48aa4cec242dc0c29865b06347573fdd1ae Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 25 Nov 2026 06:41:14 -0300 Subject: TagState: a question asks in the rows its tag takes at rest: the hint goes first, then the question is cut, its answers always shown (walk UI polish P1, UX DESIGN.md D13, asking; UX A16 "a question reflows its pane"): asking wrote its question, `▸`, its answers and `· SPC e to answer` after the path whatever their length, so a tag whose own words are short took a row more while the question waited, moving the body of a pane the user was not in; now TagState.asking measures the room the rest rows leave after the path (layout.wantedTagRows times the tag's width, less tagline.restPrefix's cells), drops the dim hint where it does not fit, then cuts the question to what is left (12 cells at least, ending `…`; the whole of it is the notice row's), never the answers; the order stays path · question ▸ answers, the mark in the box's cell; NOT DONE of D13: a message's detail on request only (`K` or Enter on its ghost, SPC e; rolled up at the next motion: today it unrolls under the caret's line, Messages.detailUnder), and progress in the right block (today drawn at the first row's right end where there is room, never wrapping: the dim ink is P2's); TEST FIRST: Messages.zig "a question never adds a row to its tag: at every width the asking tag takes the rows the tag takes at rest, its answers always shown, the question cut before them" (a file `/t/c.zig` with the tag's own text ` Put`, changed on disk under unsaved text, 56 to 160 columns: the tag's rows never past its rows at rest, `r Reload`, `k Keep mine`, `d Diff` always there; on the parent the whole question and its hint take two rows below 76 columns); core-test 1072/1243 (171 skipped); process-test with the tip's gates 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 | 28 ++++++++++++++++++++++++++++ core/TagState.zig | 19 +++++++++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-) (limited to 'core/Messages.zig') diff --git a/core/Messages.zig b/core/Messages.zig index dd5c232a..6d8d570d 100644 --- a/core/Messages.zig +++ b/core/Messages.zig @@ -1330,6 +1330,34 @@ test "a burst of the same message is one message, counted, and moves nothing on try std.testing.expect(std.mem.endsWith(u8, row.text[0..row.left], "3 files \u{d7}10")); } +test "a question never adds a row to its tag: at every width the asking tag takes the rows the tag takes at rest, its answers always shown, the question cut before them" { + const p = try Pardes.init(std.testing.allocator, .{ .cols = 120, .rows = 30 }); + defer p.deinit(); + const pane = try p.setTestFile("one\n"); + const id = p.view().active; + // A short name: the tag's rows have room for it and the answers. + p.gpa.free(pane.file.?.path); + pane.file.?.path = try p.gpa.dupe(u8, "/t/c.zig"); + const f = &pane.file.?; + f.saved_hash = panes.File.fileHash(f); + for ([_]u21{ 'G', 'o', 'f', Key.escape }) |cp| p.update(.{ .key = .{ .cp = cp } }); + // The tag's own words cut to one, so the question is the longer. + pane.tag.own = try p.gpa.dupe(u8, " Put"); + p.update(.{ .file_changed = .{ .pane = .at(id), .bytes = "zero\n" } }); + _ = p.messages.waiting(pane) orelse return error.NotAsked; + var frame = std.heap.ArenaAllocator.init(std.testing.allocator); + defer frame.deinit(); + for (56..161) |cols| { + p.update(.{ .resize = .{ .cols = @intCast(cols), .rows = 30 } }); + p.sync(); + const rest = pardes.layout.wantedTagRows(p, id); + try std.testing.expect(pane.tag_rows <= @max(rest, 1)); + const shown = try pardes.tagline.tagText(p, frame.allocator(), pane); + for ([_][]const u8{ "r Reload", "k Keep mine", "d Diff" }) |word| try std.testing.expect(std.mem.indexOf(u8, shown, word) != null); + _ = frame.reset(.retain_capacity); + } +} + test "a file changed on disk under unsaved text asks in its tag and never takes the keyboard: SPC e's keyboard answers, d shows the disk's lines as ghosts, Esc leaves it waiting, B2 on Reload reads it again" { const p = try Pardes.init(std.testing.allocator, .{ .cols = 120, .rows = 20 }); defer p.deinit(); diff --git a/core/TagState.zig b/core/TagState.zig index c364451a..3fceb7f0 100644 --- a/core/TagState.zig +++ b/core/TagState.zig @@ -296,8 +296,23 @@ fn asking(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?Head { const i = p.messages.waiting(pane) orelse return null; const said = &p.messages.live[i]; var b: Builder = .{ .arena = arena }; + // In the rows the tag takes at rest (UX D13: a question never adds a + // row): the hint goes first, then the question is cut, 12 cells at + // least, with `…` (the whole of it is on the notice row); its answers + // always show. + const tab = p.settings.tab; + const id = panes.paneIdOf(p, pane) orelse return null; + const room = @as(usize, @import("layout.zig").wantedTagRows(p, id)) * tagline.tagWidth(p, id) -| panes.File.displayWidth(tab, try tagline.restPrefix(p, arena, pane)); + const hint = if (p.view().answering == pane.serial) "· Esc later" else "· SPC e to answer"; + var answers: usize = 2; // ` ▸`, then each ` k word ` + for (said.asks.answers()) |a| answers += 3 + panes.File.displayWidth(tab, a.word) + 1; + const question = said.words(); + const wanted = 1 + panes.File.displayWidth(tab, question) + answers; try b.put(" "); - try b.put(said.words()); + if (wanted <= room) try b.put(question) else { + try b.put(question[0..panes.File.byteAtDisplay(tab, question, @max(12, room -| (1 + answers)) - 1)]); + try b.put("…"); + } try b.put(" "); try b.styled("▸", .key); for (said.asks.answers()) |a| { @@ -307,7 +322,7 @@ fn asking(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?Head { try b.put(a.word); try b.put(" "); } - try b.styled(if (p.view().answering == pane.serial) "· Esc later" else "· SPC e to answer", .dim); + if (wanted + panes.File.displayWidth(tab, hint) <= room) try b.styled(hint, .dim); return b.done(); } -- cgit v1.3