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

Method InsertBytes

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

InsertBytes creates an insert text event and executes it

(start Loc, text []byte)

Source from the content-addressed store, hash-verified

188
189// InsertBytes creates an insert text event and executes it
190func (eh *EventHandler) InsertBytes(start Loc, text []byte) {
191 if len(text) == 0 {
192 return
193 }
194 start = clamp(start, eh.buf.LineArray)
195 e := &TextEvent{
196 C: *eh.cursors[eh.active],
197 EventType: TextEventInsert,
198 Deltas: []Delta{{text, start, Loc{0, 0}}},
199 Time: time.Now(),
200 }
201 eh.DoTextEvent(e, true)
202}
203
204// Remove creates a remove text event and executes it
205func (eh *EventHandler) Remove(start, end Loc) {

Callers 2

InsertMethod · 0.95
WriteMethod · 0.80

Calls 2

DoTextEventMethod · 0.95
clampFunction · 0.85

Tested by

no test coverage detected