summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 05:24:25 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit637ab988f0922173055ea98b1f76916e42f4222a (patch)
tree4b28a9f9409482e58f091cee3e3844c1643c0144 /src/pardes.zig
parente9eae368dbbe855ad2f409913ff0d44d5ac32bd8 (diff)
downloadpardes-637ab988f0922173055ea98b1f76916e42f4222a.tar.gz
pardes-637ab988f0922173055ea98b1f76916e42f4222a.zip
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 <serial> save path; answer <path> 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 <serial> -. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig13
1 files changed, 13 insertions, 0 deletions
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 "<path>",
.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 <serial> save path`, answered on the pane's
+ // ctl with `answer <path>` 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,