Undo / Redo undo undoes previous action
()
| 440 | |
| 441 | // undo undoes previous action |
| 442 | func (ed *Editor) undo() { |
| 443 | tbes := ed.Buffer.undo() |
| 444 | if tbes != nil { |
| 445 | tbe := tbes[len(tbes)-1] |
| 446 | if tbe.Delete { // now an insert |
| 447 | ed.SetCursorShow(tbe.Reg.End) |
| 448 | } else { |
| 449 | ed.SetCursorShow(tbe.Reg.Start) |
| 450 | } |
| 451 | } else { |
| 452 | ed.cursorMovedEvent() // updates status.. |
| 453 | ed.scrollCursorToCenterIfHidden() |
| 454 | } |
| 455 | ed.savePosHistory(ed.CursorPos) |
| 456 | ed.NeedsRender() |
| 457 | } |
| 458 | |
| 459 | // redo redoes previously undone action |
| 460 | func (ed *Editor) redo() { |
no test coverage detected