diff options
Diffstat (limited to 'src/file_watch.zig')
| -rw-r--r-- | src/file_watch.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/file_watch.zig b/src/file_watch.zig index 788bcae1..9bb59683 100644 --- a/src/file_watch.zig +++ b/src/file_watch.zig @@ -561,6 +561,18 @@ pub fn applyEffect( watched.existed = std.hash.Wyhash.hash(0, file.path); return false; }; + // A text armed over its open's bytes, read just now (its content that + // read's very buffer, unedited): the file still what it was before that + // read (the same inode, size and times) needs no reading again. + if (on) if (watches[id]) |*watched| if (core.panes[id]) |pane| if (pane.file) |file| if (filesystem.localPath(file.path)) |native| { + const at = std.hash.Wyhash.hash(0, native); + for (filesystem.last_reads) |r| if (r.path == at and r.bytes == file.content.ptr and r.len == file.content.len and file.revision == 0) { + const now = identify(io, file.path) catch break; + if (!now.eql(r.file)) break; + watched.existed = std.hash.Wyhash.hash(0, file.path); + return false; + }; + }; return on and watches[id] != null and reloadPane(core, io, watches, id, false); } |
