CycleActive moves the active index by `delta`, wrapping around.
(delta int)
| 314 | |
| 315 | // CycleActive moves the active index by `delta`, wrapping around. |
| 316 | func (w *Workspace) CycleActive(delta int) { |
| 317 | if len(w.Boards) == 0 { |
| 318 | return |
| 319 | } |
| 320 | w.ActiveIdx += delta |
| 321 | for w.ActiveIdx < 0 { |
| 322 | w.ActiveIdx += len(w.Boards) |
| 323 | } |
| 324 | w.ActiveIdx %= len(w.Boards) |
| 325 | } |
| 326 | |
| 327 | // AddBoard appends a fresh board with a unique grain seed and makes it |
| 328 | // active. Returns the new board. |