From 9b641cbe3dc6c226be158e5051afafb9eb86c122 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 10:02:59 -0300 Subject: 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 --- src/File.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/File.zig') 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; } -- cgit v1.3