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

Method Execute

internal/buffer/eventhandler.go:238–254  ·  view source on GitHub ↗

Execute a textevent and add it to the undo stack

(t *TextEvent)

Source from the content-addressed store, hash-verified

236
237// Execute a textevent and add it to the undo stack
238func (eh *EventHandler) Execute(t *TextEvent) {
239 if eh.RedoStack.Len() > 0 {
240 eh.RedoStack = new(TEStack)
241 }
242 eh.UndoStack.Push(t)
243
244 b, err := config.RunPluginFnBool(nil, "onBeforeTextEvent", luar.New(ulua.L, eh.buf), luar.New(ulua.L, t))
245 if err != nil {
246 screen.TermMessage(err)
247 }
248
249 if !b {
250 return
251 }
252
253 ExecuteTextEvent(t, eh.buf)
254}
255
256// Undo the first event in the undo stack. Returns false if the stack is empty.
257func (eh *EventHandler) Undo() bool {

Callers 2

DoTextEventMethod · 0.95
MultipleReplaceMethod · 0.95

Calls 5

RunPluginFnBoolFunction · 0.92
TermMessageFunction · 0.92
ExecuteTextEventFunction · 0.85
PushMethod · 0.80
LenMethod · 0.45

Tested by

no test coverage detected