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

Method SaveReplace

undo/undo.go:176–180  ·  view source on GitHub ↗

SaveReplace replaces the current Undo record with new state, instead of creating a new record. This is useful for when you have a stream of the same type of manipulations and just want to save the last (it is better to handle that case up front as saving the state can be relatively expensive, but i

(action, data string, state []string)

Source from the content-addressed store, hash-verified

174// up front as saving the state can be relatively expensive, but
175// in some cases it is not possible).
176func (us *Stack) SaveReplace(action, data string, state []string) {
177 us.Mu.Lock()
178 nr := us.Records[us.Index]
179 go us.SaveState(nr, us.Index, state)
180}
181
182// SaveState saves given record of state at given index
183func (us *Stack) SaveState(nr *Record, idx int, state []string) {

Callers

nothing calls this directly

Calls 2

SaveStateMethod · 0.95
LockMethod · 0.65

Tested by

no test coverage detected