summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/fs.md2
-rw-r--r--src/ninep/events.zig6
-rw-r--r--src/pardes.zig11
3 files changed, 18 insertions, 1 deletions
diff --git a/docs/fs.md b/docs/fs.md
index d8080e1c..64f10e21 100644
--- a/docs/fs.md
+++ b/docs/fs.md
@@ -611,7 +611,7 @@ since a terminal is named by its directory), `exit <serial> <N>` before
the `del` of a terminal whose shell exited by itself, `ask <serial> <what>
<choices>` when a pane asks a question (answered by `answer` on its ctl),
`answer <serial> <choice|->` when it is answered, by key or ctl, `-` for
-taken back,
+taken back or for its pane closing with the question standing,
and `save <serial> <name>`,
`dump <path>` when a Dump is written and `restore <path>` in a Restore's
new log after its panes' `new`s, then `restored <old> <new>` for each pane,
diff --git a/src/ninep/events.zig b/src/ninep/events.zig
index 2112110a..61aadae2 100644
--- a/src/ninep/events.zig
+++ b/src/ninep/events.zig
@@ -122,6 +122,12 @@ pub fn noteRetire(p: *Pardes, pane: *Pane) void {
pane.fs.unannounced = false;
return;
}
+ // A question still standing ends with it, so a follower of its `ask`
+ // hears the end.
+ if (pane.prompt == .repl_choice or pane.prompt == .del_side) {
+ var rec: [32]u8 = undefined;
+ notePath(p, "answer", std.fmt.bufPrint(&rec, "{d} -", .{pane.serial}) catch "");
+ }
noteLog(p, .del, pane);
}
diff --git a/src/pardes.zig b/src/pardes.zig
index da9889ff..f55654b6 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -7096,6 +7096,17 @@ test "Del from a key asks which neighbour takes the rows; nothing else asks" {
try std.testing.expectEqual(ctlfs.Status.ok, th.wr(p, ctl, "answer -\n").reply.status);
try std.testing.expect(p.panes[asked] != null and p.panes[asked].?.prompt == .none);
try std.testing.expect(th.logHas(p, try std.fmt.bufPrint(&want, "answer {d} -\n", .{serial})));
+ // A pane closed while its question stands ends the question in the log.
+ p.newScratchBelow(top);
+ const closing = p.active;
+ p.sync();
+ const closing_serial = p.panes[closing].?.serial;
+ p.update(.{ .key = .{ .cp = ' ' } });
+ p.update(.{ .key = .{ .cp = 'd' } });
+ try std.testing.expectEqual(Pane.Prompt.del_side, p.panes[closing].?.prompt);
+ try p.removePane(closing, null);
+ try std.testing.expect(th.logHas(p, try std.fmt.bufPrint(&want, "answer {d} -\ndel {d}", .{ closing_serial, closing_serial })));
+ p.active = asked;
p.update(.{ .key = .{ .cp = ' ' } });
p.update(.{ .key = .{ .cp = 'd' } });
try std.testing.expectEqual(ctlfs.Status.ok, th.wr(p, ctl, "answer k\n").reply.status);