summaryrefslogtreecommitdiff
path: root/src/file_pane.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/file_pane.zig')
-rw-r--r--src/file_pane.zig7
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,