From 3e941015ebd2da88a296479f407e9bbf06287234 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 03:31:23 -0300 Subject: A pane restored with unsaved text is asked about before it is thrown away Exit, Restore, Del and get warn only about a pane edited since it was opened, which its saved hash says (set at its first edit). A pane a Dump kept dirty came back with no hash, so a restored session quit at once over it. Restoring one dirty now gives it a hash its text does not match. Co-Authored-By: Claude Opus 5.5 --- src/File.zig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/File.zig') diff --git a/src/File.zig b/src/File.zig index 6a1ac319..810bc766 100644 --- a/src/File.zig +++ b/src/File.zig @@ -809,6 +809,10 @@ pub fn restore(p: *Pardes, id: usize, src: dump.Pane) !*Pane { .location_rows = location_rows, .scroll = src.scroll, .revision = @intFromBool(saved.dirty), + // Restored with unsaved text, it has text to lose as an edited pane + // has: a hash its text does not match, so Exit, Restore, Del and + // get ask first (builtins.warnModifiedIn reads only edited panes). + .saved_hash = if (saved.dirty) std.hash.Wyhash.hash(0, content) +% 1 else null, .history = history, }; pane.file.?.tree_context = saved.tree_context and supportsContext(pane); -- cgit v1.3