(msg tea.Msg)
| 205 | } |
| 206 | |
| 207 | func (m *multiSelectSearchField) Update(msg tea.Msg) (huh.Model, tea.Cmd) { |
| 208 | switch msg := msg.(type) { |
| 209 | case tea.BackgroundColorMsg: |
| 210 | m.hasDarkBg = msg.IsDark() |
| 211 | |
| 212 | case msSearchResultMsg: |
| 213 | m.applySearchResult(msg.query, msg.result) |
| 214 | m.mode = msModeSelect |
| 215 | m.search.Blur() |
| 216 | return m, nil |
| 217 | |
| 218 | case spinner.TickMsg: |
| 219 | if !m.loading { |
| 220 | break |
| 221 | } |
| 222 | var cmd tea.Cmd |
| 223 | m.spinner, cmd = m.spinner.Update(msg) |
| 224 | return m, cmd |
| 225 | |
| 226 | case tea.KeyPressMsg: |
| 227 | if m.loading { |
| 228 | return m, nil // ignore keys while loading |
| 229 | } |
| 230 | switch m.mode { |
| 231 | case msModeSearch: |
| 232 | return m.updateSearch(msg) |
| 233 | case msModeSelect: |
| 234 | return m.updateSelect(msg) |
| 235 | } |
| 236 | } |
| 237 | return m, nil |
| 238 | } |
| 239 | |
| 240 | func (m *multiSelectSearchField) updateSearch(msg tea.KeyPressMsg) (huh.Model, tea.Cmd) { |
| 241 | switch { |
nothing calls this directly
no test coverage detected