fix(cli): ignore space in custom input mode (#21752)

Fixes: https://github.com/coder/internal/issues/560

"Select" CLI UI component should ignore "space" when `+Add custom value`
is highlighted. Otherwise it interprets that as a potential option...
and panics.
This commit is contained in:
Marcin Tojek
2026-01-29 14:40:02 +01:00
committed by GitHub
parent 5ae0e08494
commit bb7b49de6a
2 changed files with 18 additions and 0 deletions
+5
View File
@@ -491,6 +491,11 @@ func (m multiSelectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case tea.KeySpace:
options := m.filteredOptions()
if m.enableCustomInput && m.cursor == len(options) {
return m, nil
}
if len(options) != 0 {
options[m.cursor].chosen = !options[m.cursor].chosen
}