Skip to content

Detect other keys in Select #322

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

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

Conversation

plecos
Copy link

@plecos plecos commented Feb 18, 2025

I had a use case where I wanted to detect additional keystrokes while selecting items in Select. For example, I want to detect if the user press 's' to Skip to the next option.

So I added a new function to select called interact_opt_with_keys, where you can supply a vec of Key for the select to return back if detected. The return is a SelectResult object, which contains 2 fields: index which will have the index selected or None, and key which has which optional key was detected or None.

The keys supplied will override any of the existing keystrokes detected.

The return values for all the other interact functions remain the same.

I updated the select.rs example file to demonstrate this function.

updated select example
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.

1 participant