diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 10:02:59 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 10:36:27 -0300 |
| commit | 9b641cbe3dc6c226be158e5051afafb9eb86c122 (patch) | |
| tree | bca8b426eeea3b7a2587164c4cacab8b6278f6bb /src/File.zig | |
| parent | 70881bb4edd15fe918ee5fed4ed3e8922bc7fc6a (diff) | |
| download | pardes-9b641cbe3dc6c226be158e5051afafb9eb86c122.tar.gz pardes-9b641cbe3dc6c226be158e5051afafb9eb86c122.zip | |
An unsaved pane restored from a dump that says nothing of its disk (no disk_hash, an older dump) asks at its first Save, as for a file changed on disk
What its text was read against is unknown, so a Save could write over
a newer file without a word; it now asks once first.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/File.zig')
| -rw-r--r-- | src/File.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/File.zig b/src/File.zig index d41007c3..4fac0073 100644 --- a/src/File.zig +++ b/src/File.zig @@ -953,6 +953,16 @@ pub fn restore(p: *Pardes, id: usize, src: dump.Pane) !*Pane { if (std.hash.Wyhash.hash(0, bytes) != read_against) changed(p, @intCast(id), bytes); } else |_| {} }; + // An older dump says nothing of what the text was read against: its + // first Save asks, as for a file changed on disk, rather than guess. + if (saved.dirty and saved.disk_hash == null and output == null and onDisk(path)) { + if (filesystem.read(p, path)) |bytes| { + defer p.gpa.free(bytes); + const f = &pane.file.?; + f.disk_newer = std.hash.Wyhash.hash(0, bytes); + f.disk_newer_warned = false; + } else |_| {} + } return pane; } |
