From 637ab988f0922173055ea98b1f76916e42f4222a Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 05:24:25 -0300 Subject: A prompt a 9P request opens is an ask, answered with answer, never stacked Save through exec on a terminal (or a scratch) opened its path prompt on screen, where no script could see or answer it, and a second Save stacked another. Opened while a 9P request is served, it now logs ask save path; answer on the pane's ctl saves there and closes it, answer - closes it; asked again, the open one stands. A pane closed with it open logs answer -. Co-Authored-By: Claude Opus 5.5 --- src/pardes.zig | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/pardes.zig') diff --git a/src/pardes.zig b/src/pardes.zig index a55a22e0..7e426ba4 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -5386,7 +5386,9 @@ pub const Pardes = struct { p.needs_frame = true; p.raw_hover_intent = false; look.cancelLookHover(p); + p.fs.serving = true; const reply = ctlfs.handle(p, req); + p.fs.serving = false; if (reply.status == .err and (req.op == .write or req.op == .setattr or (req.op == .open and reply.errno == ctlfs.E.NOSPC) or (req.op == .release and req.remove))) ctlfs.events.noteError(p, req, reply); // The request was a whole step of its own, so it settles the way a // step does: the cursor and scroll reconciled, the scripted panes @@ -5632,6 +5634,8 @@ pub const Pardes = struct { const asked = p.panes[id] orelse return null; switch (asked.prompt) { .del_side => return "k j", + // Any path; `-` takes it back. + .save => return "", .repl_choice => { const ask = p.repl_ask orelse return null; var w = std.Io.Writer.fixed(buf); @@ -5990,6 +5994,15 @@ pub const Pardes = struct { p.fs.refused = true; return; } + // Asked for over 9P (Save from an exec on a terminal): a question + // the log says, `ask save path`, answered on the pane's + // ctl with `answer ` or `answer -`; asked again, the one + // already open stands, not a second on top of it. + if (request == .save and p.fs.serving) { + if (pane.prompt == .save) return; + var rec: [32]u8 = undefined; + ctlfs.events.notePath(p, "ask", std.fmt.bufPrint(&rec, "{d} save path", .{pane.serial}) catch ""); + } const marker = switch (request) { .search => |marker| marker, .save => config.save_marker, -- cgit v1.3