mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-21 00:07:16 +09:00
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.
This commit is contained in:
committed by
Dmytro Maluka
parent
c0f6b65ed6
commit
352fd2be22
@@ -1,6 +1,8 @@
|
||||
package buffer
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
|
||||
"github.com/zyedidia/micro/v2/internal/config"
|
||||
"github.com/zyedidia/micro/v2/internal/screen"
|
||||
)
|
||||
@@ -13,7 +15,12 @@ func (b *Buffer) SetOptionNative(option string, nativeValue interface{}) error {
|
||||
if !b.Modified() {
|
||||
e := calcHash(b, &b.origHash)
|
||||
if e == ErrFileTooLarge {
|
||||
b.Settings["fastdirty"] = false
|
||||
b.Settings["fastdirty"] = true
|
||||
}
|
||||
} else {
|
||||
b.origHash = [md5.Size]byte{}
|
||||
if b.Size() > LargeFileThreshold {
|
||||
b.Settings["fastdirty"] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user