diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-24 21:01:37 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-24 21:01:54 -0300 |
| commit | e91261ff4f4602afec14d2fb958fd3e51a4dc62d (patch) | |
| tree | d9a50458be65477a0679159373d2e05eb4c1787f /core/keys.zig | |
| parent | 1ebc8974489e46aee26409d54d7f1de567dbbb4a (diff) | |
| download | pardes-e91261ff4f4602afec14d2fb958fd3e51a4dc62d.tar.gz pardes-e91261ff4f4602afec14d2fb958fd3e51a4dc62d.zip | |
messages: a background question waits in its pane's tag and never takes the keyboard; SPC e gives it the keyboard, Esc leaves it waiting (pick-ui SPEC §10.2, §10.4, §3.2 asking, walk UI line C item 4): a file that changes on disk under unsaved text is now a question of its pane (one at a time: File.changed), its answers r Reload, k Keep mine and d Diff (Messages.Ask.answers); while the tag is at rest the question is drawn after the path as computed prefix text, 'changed on disk ▸ r Reload k Keep mine d Diff · SPC e to answer' (Messages.askingText; the tag's own words stay after it until the head of ruling R1 takes their place), its mark ? in the box and the notice row's '1 question · SPC e'; the keys stay the body's: View.answering (a pane's serial, the view's own keyboard state, ruling R4) is set by SPC e (item 5) and makes the answer's key answer it in handleKey's first slot, Esc leaving it waiting; the own-command questions (Del's side, a REPL's choice) keep that slot as they were; B2 on an answer's word in its tag answers it (exec.execute: Messages.answerWord); r reads the file again with the consent Get would ask for, k keeps the text and says so, d reads the disk's text (the host's read, taped) and shows where it parts from the buffer as ghost rows under that line, the disk's + lines first (Messages.diskDiff, Said.open: shown whatever the caret), d again hides them; an answer is logged ('... · answered Reload'); Messages.waitingAnswers is what a : lists first (for agent E); 9P /log says 'msg N changed on disk' (monkey9p's checker reads that); tests: Messages.zig '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', ninep/ctl.zig's disk-change test now finds the question; tui: core-test, shell-test, pane-test, behaviour-test pass; process-test: filewatch's golden takes the question (its tag row and its notice row), Restore's root-ctl case failed once under load and passes alone
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'core/keys.zig')
| -rw-r--r-- | core/keys.zig | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/keys.zig b/core/keys.zig index 5257a093..68e3585d 100644 --- a/core/keys.zig +++ b/core/keys.zig @@ -206,6 +206,23 @@ pub fn handleKey(p: *Pardes, key: Key) void { } return; } + // A background question SPC e gave the keyboard: one of its answers' + // keys answers it (Diff leaves it asking), Esc leaves it waiting, and + // nothing else gets past it (pick-ui SPEC §10.4). + if (p.view().answering != 0) answering: { + const v = p.view(); + const at = p.paneBySerial(v.answering) orelse break :answering; + const i = p.messages.waiting(p.panes[at].?) orelse break :answering; + if (key.cp == Key.escape and !key.ctrl and !key.alt) { + v.answering = 0; + p.needs_frame = true; + return; + } + if (key.ctrl or key.alt or key.cp > 0x7f) return; + if (pardes.Messages.answer(p, i, @intCast(key.cp)) and key.cp != 'd') v.answering = 0; + return; + } + p.view().answering = 0; if (p.view().window_pick != null) return layout.windowKey(p, key); const pane = p.panes[p.view().active] orelse return; layout.noteTyped(p); |
