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

Method Redo

undo/undo.go:251–264  ·  view source on GitHub ↗

Redo returns the action, data at the *next* index, and the state at the index *after that*. returning nil if already at end of saved records.

()

Source from the content-addressed store, hash-verified

249// index *after that*.
250// returning nil if already at end of saved records.
251func (us *Stack) Redo() (action, data string, state []string) {
252 us.Mu.Lock()
253 if us.Index >= len(us.Records)-2 {
254 us.Mu.Unlock()
255 return
256 }
257 us.Index++
258 rec := us.Records[us.Index] // action being redone is this one
259 action = rec.Action
260 data = rec.Data
261 state = us.RecState(us.Index + 1) // state is the one *after* it
262 us.Mu.Unlock()
263 return
264}
265
266// RedoTo returns the action, action data, and state at the given index,
267// returning nil if already at end of saved records.

Callers

nothing calls this directly

Calls 3

RecStateMethod · 0.95
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected