| 250 | } |
| 251 | |
| 252 | func (m *multiSelectSearchField) updateSearch(msg tea.KeyPressMsg) (huh.Model, tea.Cmd) { |
| 253 | switch { |
| 254 | case key.Matches(msg, key.NewBinding(key.WithKeys("enter", "tab"))): |
| 255 | query := m.search.Value() |
| 256 | if query == m.lastQuery { |
| 257 | // Query unchanged — just switch to select mode. |
| 258 | m.mode = msModeSelect |
| 259 | m.search.Blur() |
| 260 | return m, nil |
| 261 | } |
| 262 | // New query — clear input and search in background with spinner. |
| 263 | m.search.SetValue("") |
| 264 | return m, m.startSearch(query) |
| 265 | |
| 266 | case key.Matches(msg, key.NewBinding(key.WithKeys("shift+tab"))): |
| 267 | return m, huh.PrevField |
| 268 | |
| 269 | default: |
| 270 | var cmd tea.Cmd |
| 271 | m.search, cmd = m.search.Update(msg) |
| 272 | return m, cmd |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | func (m *multiSelectSearchField) updateSelect(msg tea.KeyPressMsg) (huh.Model, tea.Cmd) { |
| 277 | switch { |