-
Notifications
You must be signed in to change notification settings - Fork 69
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
Provide access to the underlying crossterm Events. #129
Comments
I'm currently working on #126 to make exactly this possible. The idea is to provide APIs to all relevant layers and make inquire really extensible. What you described should be possible soon! |
Holy are you ever responsive. Thanks so much for your hard work. This is an awesome crate. Great to hear you've already got this in the works! |
Giving some more context, the primary goal is to enable testability, which will be achieved by adding a middleware layer between key events and the prompts handling them called an "Action". Think Submit, MoveUp, etc. The API for that will be straightforward, I'll simply expose a For your use case, the API gets a little trickier. We must find a good way to:
In my mind the most common use-case for the custom Now to achieve what you're looking for, I have an idea but it feels clunky I guess, so I was looking to get your thoughts on what would look good for you (and everyone else :) ) The initial idea would be to maybe add a new variant to the Action enum, e.g. Let me know what you think |
I actually think this sounds perfectly reasonable. It would be nice if there was a built in Action that could abort the prompt and clear the current line of output, but if that is too far out of scope that could be accomplished with the callback you mentioned. I'd be perfectly happy with that solution. And for the record I don't consider that to be too much boilerplate at all. Seems great! |
I think this might be useful for something I'm trying to do as well. I'd like to get the |
I have a project called interactive-parse that builds JsonSchema types interactively using inquire. It calls various inquire methods many times to eventually build out the structure, and I would like to implement an
undo
feature which allows the user to revert to a previous prompt and fix an error. As an example, upon receivingctrl+z
I would like to kill the current inquire prompt, clear the last line in the terminal, and re call the previous inquire prompt. So far with my experimentation on cross term, it seems impossible for me to intercept the key presses without accidentally stealing them from the inquire prompt. Admittedly my knowledge here is lacking so it's possible I'm asking for the wrong feature here. Another potential solution to my problem would be the ability to pass a map of certain crossterm events which correspond to a list of preprogrammed actions (aborting the current prompt for example).The text was updated successfully, but these errors were encountered: