-
Notifications
You must be signed in to change notification settings - Fork 285
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
Key press event fires twice #797
Comments
Since 0.26 Crossterm detects key release events for Windows which means that downstream has to explicitly ignore it if you only want one event to fire. For example, this change to the lines in if let Event::Key(KeyEvent {
code,
kind: KeyEventKind::Press,
..
}) = event::read()?
{
match code {
KeyCode::Char('q') => return Ok(()),
KeyCode::Left => app.items.unselect(),
KeyCode::Down => app.items.next(),
KeyCode::Up => app.items.previous(),
_ => {}
}
} |
programingjd
added a commit
to programingjd/heh
that referenced
this issue
Jul 30, 2023
…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
ndd7xv
pushed a commit
to ndd7xv/heh
that referenced
this issue
Jul 30, 2023
…sequence, key events were handled twice, one for key press and one for key release. (#78) This fixes the issue by ignoring events when the type is not a key press. See relevant issue on crossterm: crossterm-rs/crossterm#797
Should this be closed? |
Possibly waiting for #778? |
This was referenced Jan 3, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Event fires on keyup and keydown
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It only fires once
OS
Windows
Terminal/Console
conhost, alacritty, powershell.
The text was updated successfully, but these errors were encountered: