fix: off-by-one error in spinner example

This commit is contained in:
Scott Leggett 2022-09-21 14:34:02 +08:00 committed by Christian Muehlhaeuser
parent 5d1ffa74cd
commit 900a842f50
1 changed files with 1 additions and 1 deletions

View File

@ -55,7 +55,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, tea.Quit return m, tea.Quit
case "h", "left": case "h", "left":
m.index-- m.index--
if m.index <= 0 { if m.index < 0 {
m.index = len(spinners) - 1 m.index = len(spinners) - 1
} }
m.resetSpinner() m.resetSpinner()