diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 22:17:49 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:15 -0300 |
| commit | 4793520998969439bb569c968c3143ae46aefc66 (patch) | |
| tree | 2777799bd5f2cad34c3305b5ff50e2710040836c /src/ninep/ctl.zig | |
| parent | 754ffc99799c3a251634c1eff9a16eabbd73b31c (diff) | |
| download | pardes-4793520998969439bb569c968c3143ae46aefc66.tar.gz pardes-4793520998969439bb569c968c3143ae46aefc66.zip | |
A pane's question is logged as ask, and answer on its ctl answers it
A script could not answer the several-REPLs question, which only a key
could. Every question a pane asks on its notice band (which REPL takes an
exec, Del's side from the keyboard) is now logged as `ask <serial> <what>
<choices>`, and `answer <choice>` on the pane's ctl answers it as that key
would, `answer -` taking it back as Esc does. One function answers for a
key and for the ctl.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
| -rw-r--r-- | src/ninep/ctl.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index edf81cd9..8ac60ec5 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -506,6 +506,14 @@ pub fn writePane(p: *Pardes, req: Req, pane: *Pane) Reply { if (!held) return tree.failText(req.tag, E.INVAL, e_not_locked); held = false; if (apply) pane.fs.lock = null; + } else if (std.mem.startsWith(u8, line, "answer ")) { + // The pane's question (its `ask` in the log), answered. + const choice = std.mem.trim(u8, line["answer ".len..], " "); + if (choice.len != 1) return refuse(p, req, "answer takes one choice, or -", line); + const id = p.paneBySerial(serial).?; + if (p.panes[id].?.prompt != .del_side and p.panes[id].?.prompt != .repl_choice) + return refuse(p, req, "no question asked", line); + if (apply) _ = p.answerQuestion(id, if (choice[0] == '-') null else choice[0]); } else if (!apply) { if (checkBuiltin(p, req, line, .pane)) |refusal| return refusal; } else if (runBuiltin(p, req, p.paneBySerial(serial).?, line)) |refusal| { |
