mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user