-
Notifications
You must be signed in to change notification settings - Fork 34
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
Recognize Escape
key when not used in escape sequence
#193
Comments
That's a good idea, and I did look into that, but I wasn't able to find a timeout value that was reliable without being ususably long. The main issue is that there's not actually an upper bound on timeouts for ANSI sequences: you can manually type |
That's an unfortunate compatibility requirement but understandable. Maybe this timeout could be configured/enabled manually by the programmer? Some application don't want to have use cases for manually typing those sequences and they could instead configure Mordant to have the "single escape after xxx ms" behaviour. |
You already can! Pass a timeout to readEvent and it will report a single Feel free to try that, but I found that even with high timeout values I was still seeing escape sequences get split up. |
Thanks! That seems to work even over network with just a 4 ms timeout set. However, if I read the source correctly the same small timeout will apply to all |
This could be solved using the Kitty keyboard protocol for terminals that supports it. |
I decided to go with the short timeout approach. It means you can't type in escape sequences any more, but that seems like a much less common use case than using the escape key normally. The Kitty protocol is interesting, but most terminals don't support it yet. So it's not a high priority, but we could open a separate issue if we still think it's worth it. |
Moved from comment on pull request: #192 (comment)
ESC
can both mean the escape key was pressed as well as be the start of an escape sequence.It might be possible to also use a short timeout on the second read here.
Since every
ESC
in escape sequences is quickly followed by other characters this would allow to distinguishing from singleEscape
key presses and users would not need to press escape twice.The text was updated successfully, but these errors were encountered: