popoverMoveSelection wraps the selection index modulo the filtered list.
(delta int)
| 22 | |
| 23 | // popoverMoveSelection wraps the selection index modulo the filtered list. |
| 24 | func (m Model) popoverMoveSelection(delta int) (tea.Model, tea.Cmd) { |
| 25 | if len(m.suggest) == 0 { |
| 26 | return m, nil |
| 27 | } |
| 28 | m.suggestIdx = (m.suggestIdx + delta + len(m.suggest)) % len(m.suggest) |
| 29 | return m, nil |
| 30 | } |
| 31 | |
| 32 | // refreshSuggest recomputes the popover from the textarea: command level before |
| 33 | // the first space, argument level after it. |