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

Fix usage of tcell's Rune() #3337

Merged
merged 2 commits into from
Jun 10, 2024
Merged

Conversation

dmaluka
Copy link
Collaborator

@dmaluka dmaluka commented Jun 10, 2024

According to tcell documentation, Rune() should only be used for KeyRune events. Otherwise its return value is not guaranteed and should not be relied upon.

This fixes issue #2947: Esc key not working on Windows, since tcell sends lone Esc key event with rune == 0 on Unix but with rune == 27 (the keycode) on Windows.

This also allows us to remove the hack in findSingleEvent() treating Esc as a special case.

Fixes #2947

According to tcell documentation, Rune() should only be used for KeyRune
events. Otherwise its return value is not guaranteed and should not be
relied upon.

This fixes issue zyedidia#2947: Esc key not working on Windows, since tcell
sends lone Esc key event with rune == 0 on Unix but with rune == 27
(the keycode) on Windows.
@dmaluka dmaluka changed the title Keyrune usage fix Fix usage of tcell's Rune() Jun 10, 2024
@Neko-Box-Coder
Copy link
Contributor

Nice spot.
I will test this later this week and we can merge this and close #3304 if it works on Windows.
Thanks a lot for the fix.

@JoeKar
Copy link
Collaborator

JoeKar commented Jun 10, 2024

Tested it today at work and it works too for the failing scenario.
It's the other way around to ignore the undefined values, which we considered before.

@JoeKar JoeKar merged commit 5540cae into zyedidia:master Jun 10, 2024
3 checks passed
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.

Windows: ESC key only works in "raw" tab (regression, patch inside)
3 participants