| 238 | } |
| 239 | |
| 240 | func (m *multiSelectSearchField) updateSearch(msg tea.KeyPressMsg) (huh.Model, tea.Cmd) { |
| 241 | switch { |
| 242 | case key.Matches(msg, key.NewBinding(key.WithKeys("enter", "tab"))): |
| 243 | query := m.search.Value() |
| 244 | if query == m.lastQuery { |
| 245 | // Query unchanged — just switch to select mode. |
| 246 | m.mode = msModeSelect |
| 247 | m.search.Blur() |
| 248 | return m, nil |
| 249 | } |
| 250 | // New query — clear input and search in background with spinner. |
| 251 | m.search.SetValue("") |
| 252 | return m, m.startSearch(query) |
| 253 | |
| 254 | case key.Matches(msg, key.NewBinding(key.WithKeys("shift+tab"))): |
| 255 | return m, huh.PrevField |
| 256 | |
| 257 | default: |
| 258 | var cmd tea.Cmd |
| 259 | m.search, cmd = m.search.Update(msg) |
| 260 | return m, cmd |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | func (m *multiSelectSearchField) updateSelect(msg tea.KeyPressMsg) (huh.Model, tea.Cmd) { |
| 265 | switch { |