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

Windows duplicates Escape key input. #4038

Closed
kupuguy opened this issue Jan 17, 2024 · 4 comments · Fixed by #4082
Closed

Windows duplicates Escape key input. #4038

kupuguy opened this issue Jan 17, 2024 · 4 comments · Fixed by #4082
Assignees
Labels
bug Something isn't working

Comments

@kupuguy
Copy link
Contributor

kupuguy commented Jan 17, 2024

Have you checked closed issues? https://github.com/Textualize/textual/issues?q=is%3Aissue+is%3Aclosed

Please give a brief but clear explanation of the issue. If you can, include a complete working example that demonstrates the bug. Check it can run without modifications.

It will be helpful if you run the following command and paste the results:

textual diagnose

Feel free to add screenshots and / or videos. These can be very helpful!

To reproduce run textual keys and press some keys. Pressing Esc shows two keys, other keys show only once:
image

I think the problem is with https://github.com/Textualize/textual/blob/0ad03f3731ae922d1faa6852e14ea60e6932b198/src/textual/drivers/win32.py#L267C64-L267C64

This line processes both the key down and the key up events for esc which results in it appearing as two keys in the input. Simply changing the line to read if key_event.bKeyDown: appears to fix the issue as escape now only appears once in the input and other keys such as function keys continue to work as before.

Textual Diagnostics

Versions

Name Value
Textual 0.47.1
Rich 13.7.0

Python

| Name | Value
|
|----------------|---------------------------------------------------------------------------------------------------------|
| Version | 3.12.1
|
| Implementation | CPython
|
| Compiler | MSC v.1937 64 bit (AMD64)
|
| Executable | C:\Users\dunca\AppData\Local\pypoetry\Cache\virtualenvs\dwarf-copier-_FteSHy5-py3.12\Scripts\python.exe |

Operating System

Name Value
System Windows
Release 11
Version 10.0.22621

Terminal

Name Value
Terminal Application Windows Terminal
TERM Not set
COLORTERM Not set
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

Name Value
size width=116, height=30
legacy_windows False
min_width 1
max_width 116
is_terminal True
encoding utf-8
max_height 30
justify None
overflow None
no_wrap False
highlight None
markup None
height None
@Textualize Textualize deleted a comment from github-actions bot Jan 18, 2024
@rodrigogiraoserrao
Copy link
Contributor

Hey, thanks for opening this issue and for doing some investigation beforehand.
We'll add this to our backlog!

@rodrigogiraoserrao rodrigogiraoserrao added the bug Something isn't working label Jan 18, 2024
@willmcgugan
Copy link
Collaborator

In To Do. Suspect @kupuguy is correct about the root cause.

@davep davep self-assigned this Jan 31, 2024
davep added a commit to davep/textual that referenced this issue Jan 31, 2024
davep added a commit to davep/textual that referenced this issue Jan 31, 2024
Co-authored-by: Duncan Booth <kupuguy@gmail.com>
Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

@davep
Copy link
Contributor

davep commented Jan 31, 2024

Thanks for that @kupuguy, now in main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants