Skip to content

Commit

Permalink
fix: select all keybinding
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <[email protected]>
  • Loading branch information
caarlos0 committed Jul 25, 2024
1 parent 8422c49 commit b4e3fc0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions choose/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ func (o Options) Run() error {
theme.Focused.SelectedPrefix = o.SelectedItemStyle.ToLipgloss().SetString(o.SelectedPrefix)
theme.Focused.UnselectedPrefix = o.ItemStyle.ToLipgloss().SetString(o.UnselectedPrefix)

keymap := huh.NewDefaultKeyMap()
keymap.MultiSelect.ToggleAll.SetKeys("a", "ctrl+a")

Check failure on line 48 in choose/command.go

View workflow job for this annotation

GitHub Actions / lint

keymap.MultiSelect.ToggleAll undefined (type huh.MultiSelectKeyMap has no field or method ToggleAll) (typecheck)

Check failure on line 48 in choose/command.go

View workflow job for this annotation

GitHub Actions / lint

keymap.MultiSelect.ToggleAll undefined (type huh.MultiSelectKeyMap has no field or method ToggleAll)) (typecheck)

Check failure on line 48 in choose/command.go

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

keymap.MultiSelect.ToggleAll undefined (type huh.MultiSelectKeyMap has no field or method ToggleAll)

Check failure on line 48 in choose/command.go

View workflow job for this annotation

GitHub Actions / lint-soft

keymap.MultiSelect.ToggleAll undefined (type huh.MultiSelectKeyMap has no field or method ToggleAll) (typecheck)

Check failure on line 48 in choose/command.go

View workflow job for this annotation

GitHub Actions / lint-soft

keymap.MultiSelect.ToggleAll undefined (type huh.MultiSelectKeyMap has no field or method ToggleAll)) (typecheck)

Check failure on line 48 in choose/command.go

View workflow job for this annotation

GitHub Actions / build (macos-latest)

keymap.MultiSelect.ToggleAll undefined (type huh.MultiSelectKeyMap has no field or method ToggleAll)

Check failure on line 48 in choose/command.go

View workflow job for this annotation

GitHub Actions / snapshot / snapshot

keymap.MultiSelect.ToggleAll undefined (type huh.MultiSelectKeyMap has no field or method ToggleAll)

Check failure on line 48 in choose/command.go

View workflow job for this annotation

GitHub Actions / lint

keymap.MultiSelect.ToggleAll undefined (type huh.MultiSelectKeyMap has no field or method ToggleAll) (typecheck)

Check failure on line 48 in choose/command.go

View workflow job for this annotation

GitHub Actions / lint

keymap.MultiSelect.ToggleAll undefined (type huh.MultiSelectKeyMap has no field or method ToggleAll)) (typecheck)

Check failure on line 48 in choose/command.go

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

keymap.MultiSelect.ToggleAll undefined (type huh.MultiSelectKeyMap has no field or method ToggleAll)

Check failure on line 48 in choose/command.go

View workflow job for this annotation

GitHub Actions / lint-soft

keymap.MultiSelect.ToggleAll undefined (type huh.MultiSelectKeyMap has no field or method ToggleAll) (typecheck)

Check failure on line 48 in choose/command.go

View workflow job for this annotation

GitHub Actions / lint-soft

keymap.MultiSelect.ToggleAll undefined (type huh.MultiSelectKeyMap has no field or method ToggleAll)) (typecheck)

Check failure on line 48 in choose/command.go

View workflow job for this annotation

GitHub Actions / build (macos-latest)

keymap.MultiSelect.ToggleAll undefined (type huh.MultiSelectKeyMap has no field or method ToggleAll)

Check failure on line 48 in choose/command.go

View workflow job for this annotation

GitHub Actions / snapshot / snapshot

keymap.MultiSelect.ToggleAll undefined (type huh.MultiSelectKeyMap has no field or method ToggleAll)

for _, s := range o.Selected {
for i, opt := range options {
if s == opt.Key || s == opt.Value {
Expand All @@ -52,15 +55,15 @@ func (o Options) Run() error {
}
}

if o.NoLimit {
o.Limit = len(o.Options)
}

width := max(widest(o.Options)+
max(lipgloss.Width(o.SelectedPrefix)+lipgloss.Width(o.UnselectedPrefix))+
lipgloss.Width(o.Cursor)+1, lipgloss.Width(o.Header)+widthBuffer)

if o.Limit > 1 {
if o.NoLimit {
o.Limit = 0
}

if o.Limit > 1 || o.NoLimit {
var choices []string

field := huh.NewMultiSelect[string]().
Expand Down

0 comments on commit b4e3fc0

Please sign in to comment.