Skip to content

Commit 352fd2b

Browse files
JoeKardmaluka
authored andcommitted
buffer/settings: On fastdirty off set to on in case of "large file"
This behavior is then aligned to the actual documentation of `fastdirty`. Additionally set the origHash to zero in case the buffer was already modified.
1 parent c0f6b65 commit 352fd2b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

internal/buffer/settings.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package buffer
22

33
import (
4+
"crypto/md5"
5+
46
"github.com/zyedidia/micro/v2/internal/config"
57
"github.com/zyedidia/micro/v2/internal/screen"
68
)
@@ -13,7 +15,12 @@ func (b *Buffer) SetOptionNative(option string, nativeValue interface{}) error {
1315
if !b.Modified() {
1416
e := calcHash(b, &b.origHash)
1517
if e == ErrFileTooLarge {
16-
b.Settings["fastdirty"] = false
18+
b.Settings["fastdirty"] = true
19+
}
20+
} else {
21+
b.origHash = [md5.Size]byte{}
22+
if b.Size() > LargeFileThreshold {
23+
b.Settings["fastdirty"] = true
1724
}
1825
}
1926
}

0 commit comments

Comments
 (0)