(msg tea.Msg)
| 217 | } |
| 218 | |
| 219 | func (m *multiSelectSearchField) Update(msg tea.Msg) (huh.Model, tea.Cmd) { |
| 220 | switch msg := msg.(type) { |
| 221 | case tea.BackgroundColorMsg: |
| 222 | m.hasDarkBg = msg.IsDark() |
| 223 | |
| 224 | case msSearchResultMsg: |
| 225 | m.applySearchResult(msg.query, msg.result) |
| 226 | m.mode = msModeSelect |
| 227 | m.search.Blur() |
| 228 | return m, nil |
| 229 | |
| 230 | case spinner.TickMsg: |
| 231 | if !m.loading { |
| 232 | break |
| 233 | } |
| 234 | var cmd tea.Cmd |
| 235 | m.spinner, cmd = m.spinner.Update(msg) |
| 236 | return m, cmd |
| 237 | |
| 238 | case tea.KeyPressMsg: |
| 239 | if m.loading { |
| 240 | return m, nil // ignore keys while loading |
| 241 | } |
| 242 | switch m.mode { |
| 243 | case msModeSearch: |
| 244 | return m.updateSearch(msg) |
| 245 | case msModeSelect: |
| 246 | return m.updateSelect(msg) |
| 247 | } |
| 248 | } |
| 249 | return m, nil |
| 250 | } |
| 251 | |
| 252 | func (m *multiSelectSearchField) updateSearch(msg tea.KeyPressMsg) (huh.Model, tea.Cmd) { |
| 253 | switch { |
nothing calls this directly
no test coverage detected