diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 08:09:08 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | f7e3441698a4621bec0d7c14eb45303753ffbead (patch) | |
| tree | 14ed04f81a0fc7aa7e07a44e4b4c413b940b3901 /src/ninep/ctl.zig | |
| parent | 72c84bd7206bba5e2323c2e7f12f2458405e800d (diff) | |
| download | pardes-f7e3441698a4621bec0d7c14eb45303753ffbead.tar.gz pardes-f7e3441698a4621bec0d7c14eb45303753ffbead.zip | |
A rename alone does not make a pane dirty
Any rename marked the pane dirty (saved revision one back), while the
guards ask only whether its text was ever edited: /index said dirty for a
pane Exit let go without asking. The name is no edit now, so /index, the
guards and Restore agree; Save writes under the new name all the same.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
| -rw-r--r-- | src/ninep/ctl.zig | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 0b1ec194..8cf4f0a8 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1417,9 +1417,10 @@ test "get reloads the pane from disk and reports a missing file without losing d try testing.expectEqualStrings("from disk\n", pane.file.?.content); try testing.expect(!pane_files.dirtyOf(pane)); try testing.expect(pane.file.?.history.undo_len > 0); - // What it had (renamed, so dirty) was thrown away for it: logged. + // Renamed but never edited, it was clean: nothing thrown away, nothing + // logged as reloaded over edits. var reloaded: [32]u8 = undefined; - try testing.expect(th.logHas(p, try std.fmt.bufPrint(&reloaded, "changed {d} reloaded\n", .{serial}))); + try testing.expect(!th.logHas(p, try std.fmt.bufPrint(&reloaded, "changed {d} reloaded\n", .{serial}))); _ = wr(p, Node.of(serial, .name), try std.fmt.bufPrint(&name, "{s}/missing.txt\n", .{directory})); _ = wr(p, Node.of(serial, .body), "unsaved\n"); @@ -1440,7 +1441,7 @@ test "exec Save writes the named file through the host" { const serial = serialOf(p); const pane = p.panes[0].?; try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .name), "/tmp/renamed.txt\n").reply.status); - try testing.expect(pane_files.dirtyOf(pane)); + try testing.expect(!pane_files.dirtyOf(pane)); // a name alone is no edit; Save writes all the same const saved = wr(p, Node.of(serial, .exec), "Save\n"); try testing.expectEqual(Status.ok, saved.reply.status); try testing.expect(saved.saved); |
