From 58aae9a1f7aca8e64814c8775b0c17bf93f4da0f Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 18 Aug 2026 15:13:50 -0300 Subject: nested + pardes: snapshot updates and small behavior fixes across panes --- src/file_pane.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/file_pane.zig') diff --git a/src/file_pane.zig b/src/file_pane.zig index abf37448..fd0ab2b7 100644 --- a/src/file_pane.zig +++ b/src/file_pane.zig @@ -36,7 +36,8 @@ pub const State = struct { /// goes through setContent, which bumps this; a pipe completion accepted /// against another revision would overwrite intervening work. revision: u32 = 0, - /// Revision last handed to Save. Equal means the screen matches disk. + /// Revision last known to match disk, after Save or an external reload. + /// Equal means the screen matches disk. saved_revision: u32 = 0, /// Non-null for a generated output buffer rather than an on-disk file. output: ?output_pane.Output = null, @@ -485,6 +486,10 @@ pub fn changed(p: *Pardes, id: u8, bytes: []const u8) void { const new = p.gpa.dupe(u8, bytes) catch return; pushUndo(p, pane); setContent(p, f, new); + // These bytes came from the watched path, so the new on-screen revision + // is already saved. Undoing back to displaced local work bumps revision + // again and makes that restored edit dirty, as it should. + f.saved_revision = f.revision; // restoreSnap only consumes cursor/selection from this synthetic snapshot. restoreSnap(pane, f, .{ .content = undefined, -- cgit v1.3