startSearch launches an async search and returns a tea.Cmd that will deliver the result via msSearchResultMsg.
(query string)
| 113 | // startSearch launches an async search and returns a tea.Cmd that will |
| 114 | // deliver the result via msSearchResultMsg. |
| 115 | func (m *multiSelectSearchField) startSearch(query string) tea.Cmd { |
| 116 | m.loading = true |
| 117 | searchFunc := m.searchFunc |
| 118 | return tea.Batch( |
| 119 | func() tea.Msg { |
| 120 | return msSearchResultMsg{query: query, result: searchFunc(query)} |
| 121 | }, |
| 122 | m.spinner.Tick, |
| 123 | ) |
| 124 | } |
| 125 | |
| 126 | // applySearchResult processes a completed search and rebuilds the option list. |
| 127 | func (m *multiSelectSearchField) applySearchResult(query string, result MultiSelectSearchResult) { |