diff options
| author | Gabriel Schneider <[email protected]> | 2026-08-18 15:13:50 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-18 23:45:54 -0300 |
| commit | 58aae9a1f7aca8e64814c8775b0c17bf93f4da0f (patch) | |
| tree | 098a5afec048efc2b99871a1136ae32ab4a29fdc /src/file_pane.zig | |
| parent | 382abe3dafb872b3e6c9792a9cc0abcf6267e180 (diff) | |
| download | pardes-58aae9a1f7aca8e64814c8775b0c17bf93f4da0f.tar.gz pardes-58aae9a1f7aca8e64814c8775b0c17bf93f4da0f.zip | |
nested + pardes: snapshot updates and small behavior fixes across panes
Diffstat (limited to 'src/file_pane.zig')
| -rw-r--r-- | src/file_pane.zig | 7 |
1 files changed, 6 insertions, 1 deletions
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, |
