MCPcopy
hub / github.com/micro-editor/micro / setModified

Method setModified

internal/buffer/buffer.go:142–161  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

140}
141
142func (b *SharedBuffer) setModified() {
143 if b.Type.Scratch {
144 return
145 }
146
147 if b.Settings["fastdirty"].(bool) {
148 b.isModified = true
149 } else {
150 var buff [md5.Size]byte
151
152 b.calcHash(&buff)
153 b.isModified = buff != b.origHash
154 }
155
156 if b.isModified {
157 b.RequestBackup()
158 } else {
159 b.CancelBackup()
160 }
161}
162
163// calcHash calculates md5 hash of all lines in the buffer
164func (b *SharedBuffer) calcHash(out *[md5.Size]byte) {

Callers 5

ApplyBackupMethod · 0.95
insertMethod · 0.95
removeMethod · 0.95
DoSetOptionNativeMethod · 0.80
RetabMethod · 0.80

Calls 3

calcHashMethod · 0.95
RequestBackupMethod · 0.95
CancelBackupMethod · 0.95

Tested by

no test coverage detected