MCPcopy Create free account
hub / github.com/cogentcore/core / undo

Method undo

texteditor/editor.go:442–457  ·  view source on GitHub ↗

Undo / Redo undo undoes previous action

()

Source from the content-addressed store, hash-verified

440
441// undo undoes previous action
442func (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
460func (ed *Editor) redo() {

Callers 2

keyInputMethod · 0.95
undoDiffMethod · 0.45

Calls 5

SetCursorShowMethod · 0.95
cursorMovedEventMethod · 0.95
savePosHistoryMethod · 0.95
NeedsRenderMethod · 0.80

Tested by

no test coverage detected