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

Method UndoOneEvent

internal/buffer/eventhandler.go:282–301  ·  view source on GitHub ↗

UndoOneEvent undoes one event

()

Source from the content-addressed store, hash-verified

280
281// UndoOneEvent undoes one event
282func (eh *EventHandler) UndoOneEvent() {
283 // This event should be undone
284 // Pop it off the stack
285 t := eh.UndoStack.Pop()
286 if t == nil {
287 return
288 }
289 // Undo it
290 // Modifies the text event
291 eh.UndoTextEvent(t)
292
293 // Set the cursor in the right place
294 if t.C.Num >= 0 && t.C.Num < len(eh.cursors) {
295 eh.cursors[t.C.Num].Goto(t.C)
296 eh.cursors[t.C.Num].NewTrailingWsY = t.C.NewTrailingWsY
297 }
298
299 // Push it to the redo stack
300 eh.RedoStack.Push(t)
301}
302
303// Redo the first event in the redo stack. Returns false if the stack is empty.
304func (eh *EventHandler) Redo() bool {

Callers 3

UndoMethod · 0.95
checkFunction · 0.80
benchEditFunction · 0.80

Calls 4

UndoTextEventMethod · 0.95
PopMethod · 0.80
GotoMethod · 0.80
PushMethod · 0.80

Tested by 2

checkFunction · 0.64
benchEditFunction · 0.64