Skip to content

Commit 0b15b57

Browse files
committed
buffer: Set fastdirty=true for large file when reopening
Similarly to how we force `fastdirty` to true when opening a large file (when creating the buffer), force it also when reopening a file, in case the file on disk became large since we opened it.
1 parent d31095f commit 0b15b57

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/buffer/buffer.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,11 @@ func (b *Buffer) ReOpen() error {
550550

551551
err = b.UpdateModTime()
552552
if !b.Settings["fastdirty"].(bool) {
553-
calcHash(b, &b.origHash)
553+
if len(data) > LargeFileThreshold {
554+
b.Settings["fastdirty"] = true
555+
} else {
556+
calcHash(b, &b.origHash)
557+
}
554558
}
555559
b.isModified = false
556560
b.RelocateCursors()

0 commit comments

Comments
 (0)