summaryrefslogtreecommitdiff
path: root/src/ninep/pane.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 08:09:08 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commitf7e3441698a4621bec0d7c14eb45303753ffbead (patch)
tree14ed04f81a0fc7aa7e07a44e4b4c413b940b3901 /src/ninep/pane.zig
parent72c84bd7206bba5e2323c2e7f12f2458405e800d (diff)
downloadpardes-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/pane.zig')
-rw-r--r--src/ninep/pane.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig
index d8329ccc..5f8fc00a 100644
--- a/src/ninep/pane.zig
+++ b/src/ninep/pane.zig
@@ -636,7 +636,9 @@ pub fn nameBuffer(p: *Pardes, id: usize, full: []const u8, preserve_tag: bool) !
if (pane.tag.own) |own| p.gpa.free(own);
pane.tag.own = null;
}
- f.saved_revision = f.revision -% 1;
+ // A name alone is no edit: dirty stays what the text made it, as
+ // the guards ask only whether it was ever edited, so /index, Exit
+ // and Restore agree. Save writes it under the new name all the same.
f.watch_after_save = fs.localPath(full) != null;
}
if (f.highlights.len > 0) p.tree_sitter_gpa.free(f.highlights);
@@ -1151,7 +1153,7 @@ test "relative names use the file directory and can name a new target" {
var expected_buf: [4096]u8 = undefined;
const expected = try std.fmt.bufPrint(&expected_buf, "{s}/created.txt", .{directory});
try testing.expectEqualStrings(expected, pane.file.?.path);
- try testing.expect(dirtyOf(pane));
+ try testing.expect(!dirtyOf(pane)); // a name alone is no edit
}
test "relative names follow a pane/new scratch's session directory and virtual directories" {