diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-25 02:03:41 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-25 02:03:41 -0300 |
| commit | 09729fc927bca5f05f99de7844069cae445598a1 (patch) | |
| tree | fab8e0b1e187c9b2f8d84a088952b71982c9f644 /core/Messages.zig | |
| parent | c9a5d230570863beb8183190d01c7e19c7696a14 (diff) | |
| download | pardes-09729fc927bca5f05f99de7844069cae445598a1.tar.gz pardes-09729fc927bca5f05f99de7844069cae445598a1.zip | |
Command: a question waiting on the pane lists its answers as `:`'s first rows, a letter typed only filtering them and Tab or a click giving one; `:open ` lists the files the panes show; and the faults the gates met (walk UI, pick-ui SPEC.md §10.4, item 4 of line E2): with a question waiting on the pane (Messages.waitingAnswers) its answers are the names' first rows, each after its key in the key ink (`r Reload`, `k Keep mine`, `d Diff`), `answers the question` on their right, the last ruled off from the tag's words as theirs is from the commands; typing filters them as the rest (Names.match on the word), so a letter never answers (`:r` is a line, `:reflow` runs reflow); Enter gives one when the current row is an answer Tab or a click put in the field, or its whole word typed, the tag at rest first (Messages.waiting, Messages.answer); a click (B1, TagState.point) on an answer gives it at once, and on a line of C-r's history puts that line in the field (Prompt.history_row marks a history row's index: a click there was read as an index of the rows); a damaged image's cursor past the rows is held to the last (Command.current); THE STAND-IN: this tree has no questions: Messages.zig's block from `---- a stand-in for line C's questions` to `---- the stand-in's end ----` has `Answer`, `waiting`, `waitingAnswers` and `answer` in the shapes of line C's (vxmpyyst), saying none, and root.zig's allowed_vars line `Messages.zig stub_asked` its test's question: THE MERGE WITH C DELETES BOTH and keeps C's; Command.zig's test asks through the stand-in here and, by `comptime @hasDecl(Messages, "stub_asked")`, through a file changed on disk under unsaved text in C's tree (`ask`, as C's own test asks), nothing to edit; THE FAULT THE SOAK MET (item 2's): `:open ` listed the session's recent files, which are its alone (Core.zig `.authority`): random keys typed `:o ` and the session listed them where a client listed none, so the band under the tag took other rows there (pane tag_rows, rows, the view's rects: the witness's names) and a PDF pane's kind diverged after its view (rtt 30: diverged 31, the tape's answers to the addon short after); now the files the panes show, each once (Command.fileOf, firstOf: replicated, 64 at most); THE FAULT THE 40,000-SEED FUZZ MET (in no code of this line: the dump's layout moved, TagState.worn and Prompt.command, and a seed met it): a dump whose fs.Namespace `opens_len` said 98 of its 64 opens was refused (walk.holdTo), and the load's errdefer (dump.zig loadKnowing) tore the namespace down over `opens[0..opens_len]`: index out of bounds, a panic where a refusal was due; Namespace.deinit holds the length to its opens now; a user restoring a damaged dump could have hit it; TEST FIRST: Command.zig "a question waiting on the pane lists its answers first, each after its key, ruled off; a letter typed only filters them; Tab onto one and Enter gives it" (a click too), fs.zig "a namespace a refused dump left saying more opens than it holds is torn down to its last" (shell-test), item 3's test clicks a history line, item 2's lists the open file; core-test 1025/1192 (167 skipped), shell-test 1239/1242, pane-test 182/184, behaviour-test and its replay 274/277 (the failures A's, as on E's tip), process-test 5 of 146 (the base's: find, builtins, leader, tagnav, ttyhelp), term-test 17/17, kitty-test 45/45; the fuzz at 40,000 join and 1,779 image seeds over a session left in `:theme o` after a Tab (TagState.worn set): pass; THE SOAK, 5 clients, FAILS: diverged 32/0/2 at rtt 30/80/207 (seeds 0-2: a PDF pane's kind state after its view, then the tape's answers to it short; the witness names the band's host pane's and the PDF pane's tag_rows, rows and tag_lead, and the view's rects), and inputs `the mouse in a kind's pane` that may_wait does not list; with `:`'s band held at 0 rows (Command.takes, a temporary edit, put back) the same soak is clean: diverged 0 at 30/80/207, no stop off may_wait: the fault is the band's (A's layout term) in a session with a kind's pane and clients, which no input of the soak reached before `:` (typed by its random keys) opened one; not fixed here
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'core/Messages.zig')
| -rw-r--r-- | core/Messages.zig | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/core/Messages.zig b/core/Messages.zig index 6b406e91..53d2951b 100644 --- a/core/Messages.zig +++ b/core/Messages.zig @@ -544,6 +544,46 @@ pub fn bands(p: *const Pardes, v: *const Pardes.View, pane: *const Pane, tag_row return n; } +// ---- a stand-in for line C's questions (walk UI; C's change vxmpyyst) ---- +// +// `:` lists the answers of a question waiting on its pane first (pick-ui +// SPEC §10.4, Command.zig). This tree has no such questions, and these say +// none: THE MERGE with C's line deletes this block, to its end marker, and +// keeps C's `Answer`, `waiting`, `waitingAnswers` and `answer`, whose +// shapes these are. `stub_asked` lets Command.zig's test ask one here. + +/// A question's answer: the key that gives it and its word. +pub const Answer = struct { key: u8, word: []const u8 }; + +/// The question waiting on `pane`, an index of the live ones: none. +pub fn waiting(m: *const Messages, pane: *const Pane) ?usize { + _ = m; + return if (@import("builtin").is_test and stub_asked != 0 and stub_asked == pane.serial) 0 else null; +} + +/// The answers of the question waiting on `pane`: none. +pub fn waitingAnswers(m: *const Messages, pane: *const Pane) []const Answer { + return if (m.waiting(pane) != null) &stub_answers else &.{}; +} + +/// Answer live question `i` with `key`: false for a key that is none of +/// its answers. +pub fn answer(p: *Pardes, i: usize, key: u8) bool { + _ = p; + _ = i; + for (stub_answers) |a| if (a.key == key) { + stub_asked = 0; + return true; + }; + return false; +} + +/// A test's question: the serial of the pane it waits on. +pub var stub_asked: u32 = 0; +const stub_answers = [_]Answer{ .{ .key = 'r', .word = "Reload" }, .{ .key = 'k', .word = "Keep mine" }, .{ .key = 'd', .word = "Diff" } }; + +// ---- the stand-in's end ---- + test "errors are said in words, and a ZON failure names its line" { var buf: [128]u8 = undefined; try std.testing.expectEqualStrings("file not found", errorWords(error.FileNotFound, &buf)); |
