Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Select All" and "Invert" Shortcuts to Multiselect #269

Open
KyleTryon opened this issue Jun 4, 2024 · 2 comments
Open

Add "Select All" and "Invert" Shortcuts to Multiselect #269

KyleTryon opened this issue Jun 4, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@KyleTryon
Copy link

Is your feature request related to a problem? Please describe.
When using a multiselect component with a long list of options where you want to select many or all of the options, can be cumbersome as you must individually select each item.

Describe the solution you'd like
It can be helpful to be able to select all items in the list to quickly select and navigate from a long list. This also allows you to more easily deselect fewer options in the case you want to select most items but not all.

Add "Ctrl+a" for a Select All shortcut

Describe alternatives you've considered
Creating a new separate component with additional options

Additional context
An Inverse Selection addition may be good too, but could be addressed later.

Source: https://github.com/charmbracelet/huh/blob/main/field_multiselect.go
The Keymap

@caarlos0
Copy link
Member

select all/none has landed on main #325

the inverse selection I'm not sure about... could you give some examples on how it would be useful?

thank you

@caarlos0 caarlos0 self-assigned this Jul 25, 2024
@caarlos0 caarlos0 added the enhancement New feature or request label Jul 25, 2024
@KyleTryon
Copy link
Author

Awesome! 🎉

For inverse, it can be helpful when selecting many items from a long list.

For example, say you are selecting multiple directories in a list:

- /dir/1
- /dir/2
- /dir/3
- /dir/4
- /dir/5
- /dir/6
- /dir/7
- /dir/8

You want to select all, besides 1,2,3.

One way to achieve this would be to select 1,2,3 and then invert the selection.
The other way (which btw I think is acceptable with select all being available), is to select all, then un-select 1,2,3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants