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

Fixed double key presses on windows due to crossterm changes #78

Merged
merged 1 commit into from
Jul 30, 2023

Conversation

programingjd
Copy link
Contributor

I tried to cargo install heh on windows, and all the key presses were handled as if they were duplicated, making it unusable.
I did some digging and found this issue on crossterm:
crossterm-rs/crossterm#797
Bascially, after the update to 0.26, on windows, crossterm reports key releases in addition to key presses instead of only key presses.
I changed the handle_input function in app.rs to ignore key inputs other than presses, as recommended in the issue previously mentioned.
This seems to solve the issue without having any adverse effects, but I've only tested on windows.

…sequence, key events were handled twice, one for key press and one for key release.

This fixes the issue by ignoring events when the type is not a key press.
See relevant issue on crossterm:
crossterm-rs/crossterm#797
Copy link
Owner

@ndd7xv ndd7xv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much! I just checked that this works on Fedora, apologies about this. I'll try and release a fixed version soon.

@codecov
Copy link

codecov bot commented Jul 30, 2023

Codecov Report

Merging #78 (4a6dfa6) into main (e6e7a82) will decrease coverage by 0.1%.
The diff coverage is 0.0%.

Additional details and impacted files
Files Changed Coverage Δ
src/app.rs 0.0% <0.0%> (ø)

@ndd7xv ndd7xv merged commit 4536146 into ndd7xv:main Jul 30, 2023
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.

2 participants