Skip to content

feat(picker): add select_all and deselect_all methods and interactive keybindings - #168

Open
miskatul-anwar wants to merge 2 commits into
aisk:masterfrom
miskatul-anwar:feat/select-all-deselect-all
Open

feat(picker): add select_all and deselect_all methods and interactive keybindings#168
miskatul-anwar wants to merge 2 commits into
aisk:masterfrom
miskatul-anwar:feat/select-all-deselect-all

Conversation

@miskatul-anwar

@miskatul-anwar miskatul-anwar commented Aug 23, 2026

Copy link
Copy Markdown

Summary

Adds select_all() and deselect_all() helper methods and interactive keybindings to Picker for multiselect mode:

  • Picker.select_all(): Selects all available options that are enabled (Option.enabled is not False).
  • Picker.deselect_all(): Clears selected_indexes.
  • Both methods safely return immediately if multiselect=False.
  • Added interactive keybindings in Picker.run_loop:
    • a (KEYS_SELECT_ALL): Triggers select_all().
    • d (KEYS_DESELECT_ALL): Triggers deselect_all().

Testing

  • Added unit test test_select_all_and_deselect_all in tests/test_pick.py.
  • Ran full pytest test suite (all passing).
  • Ran mypy type checks (clean).

@aisk

aisk commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Thanks for the PR. What's the intended use case for these methods? They aren't bound to any key in run_loop, so users can't trigger them interactively.

@miskatul-anwar

Copy link
Copy Markdown
Author

Thanks for the feedback @aisk!

The initial motivation was programmatic batch selection (and custom key handlers), but interactive keybindings make multiselect mode much more convenient.

I've updated the PR to:

  1. Bind default interactive key shortcuts in run_loop when multiselect=True:
    • a (KEYS_SELECT_ALL = (ord("a"),)): Selects all enabled options.
    • d (KEYS_DESELECT_ALL = (ord("d"),)): Deselects all options.
  2. Clean up the trailing newline in tests/test_pick.py.

@miskatul-anwar miskatul-anwar changed the title feat(picker): add select_all and deselect_all helper methods feat(picker): add select_all and deselect_all methods and interactive keybindings Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants