feat(font): implement cyclic shifting for item rotation

This commit is contained in:
Artin 2024-09-09 19:06:32 +03:30 committed by Jan De Dobbeleer
parent 835350d813
commit 79c30684f4

View file

@ -214,6 +214,26 @@ func (m *main) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}() }()
m.spinner.Spinner = spinner.Globe m.spinner.Spinner = spinner.Globe
return m, m.spinner.Tick return m, m.spinner.Tick
case "up", "k":
if m.list != nil {
if m.list.Index() == 0 {
m.list.Select(len(m.list.Items()) - 1)
} else {
m.list.Select(m.list.Index() - 1)
}
}
return m, nil
case "down", "j":
if m.list != nil {
if m.list.Index() == len(m.list.Items())-1 {
m.list.Select(0)
} else {
m.list.Select(m.list.Index() + 1)
}
}
return m, nil
} }
case zipMsg: case zipMsg: