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

Allow checking for keyboard enhancement support #717

Closed
pianohacker opened this issue Oct 3, 2022 · 2 comments · Fixed by #732
Closed

Allow checking for keyboard enhancement support #717

pianohacker opened this issue Oct 3, 2022 · 2 comments · Fixed by #732

Comments

@pianohacker
Copy link
Contributor

pianohacker commented Oct 3, 2022

Is your feature request related to a problem? Please describe.
The new keyboard enhancement feature is supported by a small (if growing) subset of terminals. It would be nice to know if the current terminal supports the protocol. This allows adjusting expected keyboard inputs, changing shortcuts, etc.

Describe the solution you'd like
The suggested way to check for support is to:

  • send a query escape sequence for the current keyboard enhancement status
  • send a query for the primary device attributes
  • check if we got two answers, or just one

I'm not immediately sure a) how to reliably do this and b) how we could provide a helper in crossterm itself. Desired workflow would just be something like:

if crossterm::event::detect_keyboard_enhancement_support(&mut stdout)? {
...

Describe alternatives you've considered if any
I don't think there's any other way to detect support. Enabling keyboard enhancement then checking the form of incoming events is possible, but that seems messy and unreliable.

@pianohacker
Copy link
Contributor Author

@TimonPost , would love your thoughts here.

@TimonPost
Copy link
Member

Would be nice to have this support. I also am not aware with how reliable this is, but we can expose the function at least and have users be able to call it. At least not directly depending crossterm on this logic.

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 a pull request may close this issue.

2 participants