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

Method SaveUndoStart

undo/undo.go:163–168  ·  view source on GitHub ↗

SaveUndoStart saves the current state -- call if MustSaveUndoStart is true. Sets a special flag for this record, and action, data are empty. Does NOT increment the index, so next undo is still as expected.

(state []string)

Source from the content-addressed store, hash-verified

161// Sets a special flag for this record, and action, data are empty.
162// Does NOT increment the index, so next undo is still as expected.
163func (us *Stack) SaveUndoStart(state []string) {
164 us.Mu.Lock()
165 nr := &Record{UndoSave: true}
166 us.Records = append(us.Records, nr)
167 us.SaveState(nr, us.Index+1, state) // do it now because we need to immediately do Undo, does unlock
168}
169
170// SaveReplace replaces the current Undo record with new state,
171// instead of creating a new record. This is useful for when

Callers

nothing calls this directly

Calls 2

SaveStateMethod · 0.95
LockMethod · 0.65

Tested by

no test coverage detected