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 support for more keys #90

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

lingrlongr
Copy link

  • Added support for different keycodes for up/down
  • Added support for quitting the menu

- Added support for different keycodes for up/down
- Added support for quitting the menu
@@ -11,10 +11,15 @@ class Option:
value: Any


GITBASH_KEY_UP = 450
GITBASH_KEY_DOWN = 456
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is gitbash?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an Windows application that provides an emulation layer for a Git command line experience in a familiar bash interface.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think instead of hard-code these special codes here, it would be better to have a method for users to config them

Copy link
Contributor

@Henri-ColibrITD Henri-ColibrITD May 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was about to fork pick to have the ability to exit!
This would combine nicely with the ability to set custom keys (so pick doesn't have to have custom keys for gitbash, or VS code as I saw in another issue).
I could work on this if the author of this PR is not interested to work on it anymore

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after thinking a bit about it (and this may be already clear for the maintainers), custom key bindings are already supported by the ability to set them at the module level. For instance to support the numpad to navigate, one might simply do

import pick
pick.KEYS_UP += (ord("8"),)
pick.KEYS_DOWN += (ord("2"),)
KEY_NUMPAD_ENTER = 459
pick.KEYS_ENTER += (KEY_NUMPAD_ENTER,)

Because of this, I will only tackle the exit option, to reduce the scope of my PR

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.

3 participants