summaryrefslogtreecommitdiff
path: root/src/ninep/events.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-30 17:40:41 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commitb196f602a6bbb53e0025140c7a3f9cbb9f23bcd2 (patch)
treef043d8d929c0083038e4bcb47b41d6b91608f44a /src/ninep/events.zig
parent13ef34f1c10a5880be411475cfabd7bb1344916b (diff)
downloadpardes-b196f602a6bbb53e0025140c7a3f9cbb9f23bcd2.tar.gz
pardes-b196f602a6bbb53e0025140c7a3f9cbb9f23bcd2.zip
Save path logs a save record naming the path it wrote
Save of a pane's own file logged `save <serial> <name>`, and so did a scratch's `Save path` (the pane takes that name). A `Save path` that writes a copy of a file pane, or a terminal's scrollback, elsewhere logged nothing, so a follower could not tell the file was written. It now logs `save <serial> <path>` with the path written, once the host has written it (events.noteLogAs). fs.md's log table says so. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/events.zig')
-rw-r--r--src/ninep/events.zig8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ninep/events.zig b/src/ninep/events.zig
index fa90fe71..a09f7278 100644
--- a/src/ninep/events.zig
+++ b/src/ninep/events.zig
@@ -160,10 +160,16 @@ pub fn noteLog(p: *Pardes, kind: LogKind, pane: *Pane) void {
if (kind == .rename) return;
announce(p);
}
+ noteLogAs(p, kind, pane, pane_files.nameOf(p, pane));
+}
+
+/// noteLog naming `path` rather than the pane's name: a `Save path` that
+/// writes a copy elsewhere is `save <serial> <path>`.
+pub fn noteLogAs(p: *Pardes, kind: LogKind, pane: *Pane, path: []const u8) void {
var buf: [4 * 4096 + 64]u8 = undefined;
var name_buf: [4 * 4096]u8 = undefined;
// As /index shows it: a newline in the name is `\n`.
- const name = shown(pane_files.nameOf(p, pane), &name_buf);
+ const name = shown(path, &name_buf);
pushLog(p, std.fmt.bufPrint(&buf, "{s} {d} {s}\n", .{ @tagName(kind), pane.serial, name }) catch return);
}