mirror of
https://github.com/charmbracelet/gum
synced 2024-05-13 11:46:40 +02:00
fix(choose): selected bug when limit == 1
This commit is contained in:
parent
995bd04e38
commit
db75c218de
|
@ -60,9 +60,13 @@ func (o Options) Run() error {
|
|||
isSelected := hasSelectedItems && currentSelected < o.Limit && arrayContains(o.Selected, option)
|
||||
// If the option is selected then increment the current selected count.
|
||||
if isSelected {
|
||||
currentSelected++
|
||||
if o.Limit == 1 {
|
||||
// When the user can choose only one option don't select the option but
|
||||
// start with the cursor hovering over it.
|
||||
startingIndex = i
|
||||
isSelected = false
|
||||
} else {
|
||||
currentSelected++
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue