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

Method RedoTo

undo/undo.go:268–281  ·  view source on GitHub ↗

RedoTo returns the action, action data, and state at the given index, returning nil if already at end of saved records.

(idx int)

Source from the content-addressed store, hash-verified

266// RedoTo returns the action, action data, and state at the given index,
267// returning nil if already at end of saved records.
268func (us *Stack) RedoTo(idx int) (action, data string, state []string) {
269 us.Mu.Lock()
270 if idx >= len(us.Records)-1 || idx <= 0 {
271 us.Mu.Unlock()
272 return
273 }
274 us.Index = idx
275 rec := us.Records[idx]
276 action = rec.Action
277 data = rec.Data
278 state = us.RecState(idx + 1)
279 us.Mu.Unlock()
280 return
281}
282
283// Reset resets the undo state
284func (us *Stack) Reset() {

Callers

nothing calls this directly

Calls 3

RecStateMethod · 0.95
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected