summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 11:38:48 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commitf0fc0be608bb1ee96c20d9f9baaefd2543fed7a2 (patch)
treec7e98a030a3efb76b9bb675fe1c96df2d63d5b31
parent0f16886d2f8f53b8d746341e3e2c9fc55f2446c2 (diff)
downloadpardes-f0fc0be608bb1ee96c20d9f9baaefd2543fed7a2.tar.gz
pardes-f0fc0be608bb1ee96c20d9f9baaefd2543fed7a2.zip
get's refusal over unsaved text logs its unsaved record, as the other refusals do
Exit, Restore, Del and Delcol log unsaved <serial> <name> before their err; get logged only the err. Co-Authored-By: Claude Opus 5.5 <[email protected]>
-rw-r--r--src/ninep/ctl.zig4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 4abb6fcd..f4a3d730 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -864,6 +864,8 @@ fn getRefused(p: *Pardes, pane: *Pane) ?[]const u8 {
const id = p.paneBySerial(pane.serial).?;
// Kept in +Unsaved, as Exit's refusal is; the notice is short. The
// write's err record logs it, not a msg too.
+ // And logged `unsaved <serial> <name>`, as the other refusals are.
+ tree.events.noteLog(p, .unsaved, pane);
const listed = std.fmt.allocPrint(p.gpa, "{s}: Modified\n\nget again to discard\n", .{f.path}) catch null;
if (listed) |content| panes.Output.openUnsaved(p, id, content);
p.fs.unlogged = true;
@@ -1465,6 +1467,8 @@ test "get reloads the pane from disk and reports a missing file without losing d
const asked = wr(p, ctl_node, "get\n");
try testing.expectEqual(E.IO, asked.errno());
try testing.expect(std.mem.endsWith(u8, asked.reply.ename, ": Modified (get again to discard)"));
+ var unsaved: [4200]u8 = undefined;
+ try testing.expect(th.logHas(p, try std.fmt.bufPrint(&unsaved, "unsaved {d} {s}/missing.txt\n", .{ serial, directory })));
try testing.expectEqual(E.NOENT, wr(p, ctl_node, "get\n").errno());
try testing.expect(p.paneBySerial(serial) != null);
try testing.expectEqualStrings("from disk\nunsaved\n", pane.file.?.content);