UndoOneEvent undoes one event
()
| 280 | |
| 281 | // UndoOneEvent undoes one event |
| 282 | func (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. |
| 304 | func (eh *EventHandler) Redo() bool { |