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

Method undoDiff

texteditor/diffeditor.go:514–532  ·  view source on GitHub ↗

undoDiff undoes last applied change, if any.

(ab int)

Source from the content-addressed store, hash-verified

512
513// undoDiff undoes last applied change, if any.
514func (dv *DiffEditor) undoDiff(ab int) error {
515 tva, tvb := dv.textEditors()
516 if ab == 1 {
517 if !dv.diffs.B.Undo() {
518 err := errors.New("No more edits to undo")
519 core.ErrorSnackbar(dv, err)
520 return err
521 }
522 tvb.undo()
523 } else {
524 if !dv.diffs.A.Undo() {
525 err := errors.New("No more edits to undo")
526 core.ErrorSnackbar(dv, err)
527 return err
528 }
529 tva.undo()
530 }
531 return nil
532}
533
534func (dv *DiffEditor) MakeToolbar(p *tree.Plan) {
535 txta := "A: " + fsx.DirAndFile(dv.FileA)

Callers 1

MakeToolbarMethod · 0.95

Calls 5

textEditorsMethod · 0.95
NewFunction · 0.92
ErrorSnackbarFunction · 0.92
UndoMethod · 0.45
undoMethod · 0.45

Tested by

no test coverage detected