Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
Action interface that wraps Do and Undo methods that are called when an operation is done/redone or undone.
type Operation ¶
type Operation struct { Name string Actions []Action DoErrorFormat func([]error) string UndoErrorFormat func([]error) string }
Operation can consist of one or more actions, whose Do methods are called in order when the opration is done/reonde and whose Undo methods are called in reverse order when the operation is undone.
type UndoStack ¶
type UndoStack struct {
// contains filtered or unexported fields
}
UndoStack enables operations to be done (executed) and keeps track of them in order to be able to undo and redo them.
func (*UndoStack) Do ¶
Do (execute) a new operation and put it on the stack.
Previously undone operations are dropped (at least if they haven been redone before).
func (*UndoStack) Redo ¶
Redo a previously undone operation.
Calls the Do methods of the operation's actions.