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

Method MarkModified

internal/buffer/buffer.go:185–202  ·  view source on GitHub ↗

MarkModified marks the buffer as modified for this frame and performs rehighlighting if syntax highlighting is enabled

(start, end int)

Source from the content-addressed store, hash-verified

183// MarkModified marks the buffer as modified for this frame
184// and performs rehighlighting if syntax highlighting is enabled
185func (b *SharedBuffer) MarkModified(start, end int) {
186 b.ModifiedThisFrame = true
187
188 start = util.Clamp(start, 0, len(b.lines)-1)
189 end = util.Clamp(end, 0, len(b.lines)-1)
190
191 if b.Settings["syntax"].(bool) && b.SyntaxDef != nil {
192 l := -1
193 for i := start; i <= end; i++ {
194 l = util.Max(b.Highlighter.ReHighlightStates(b, i), l)
195 }
196 b.Highlighter.HighlightMatches(b, start, l)
197 }
198
199 for i := start; i <= end; i++ {
200 b.LineArray.invalidateSearchMatches(i)
201 }
202}
203
204// DisableReload disables future reloads of this sharedbuffer
205func (b *SharedBuffer) DisableReload() {

Callers 3

insertMethod · 0.95
removeMethod · 0.95
RetabMethod · 0.80

Calls 5

ClampFunction · 0.92
MaxFunction · 0.92
ReHighlightStatesMethod · 0.80
HighlightMatchesMethod · 0.80

Tested by

no test coverage detected