You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Crossterm will register multiple KeyPress types. In a Windows environment, I was getting twice the keypresses instead of once. It would be interesting to allow the user to target specific KeyPressKind to avoid this issue.
Steps to reproduce
Clone the repo and run the demo example from the examples folder. When pressing keys, the KeyPress message is sent 2 times (KeyEventKind::Pressed and KeyEventKind::Released). This results in the counter being incremented twice, instead of once.
Expected behaviour
The user should be able to define the KeyEventKind when listening for KeyEvent to avoid receiving twice the same KeyEvent message.
Environment
Windows 10
x86_64
Rust 1.69.0
tui-realm 1.9.0
Additional information
See this issue for reference and more information. The actual docs for the KeyEvent in crossterm are here.
Fix (?)
I think changing the struct of KeyEvent to allow to specify KeyEventKind and passing it to crossterm would work.
The text was updated successfully, but these errors were encountered:
This seems to also cause demo app to switch focus on Tab twice, making it impossible to activate digit counter and effectively disabling this framework for windows users.
Maybe defining enum KeyEventKind with variants Unknown, Press, Release would be solution? Unknown would be field for termion and any backend that does not support the distinction, Press and Release corresponding to this - https://docs.rs/crossterm/latest/crossterm/event/struct.KeyEvent.html
Note that crossterm docs mention that on unix the kind might also be set in case if configured:
The issue with this is that it introduces back incompatibility, since all apps which were pattern matching on current KeyEvent would get error now, so strictly speaking this can only go into version 2 :(
If you run into this and need workaround, you are welcome to use my temp fix like this:
Description
Crossterm will register multiple KeyPress types. In a Windows environment, I was getting twice the keypresses instead of once. It would be interesting to allow the user to target specific
KeyPressKind
to avoid this issue.Steps to reproduce
Clone the repo and run the demo example from the
examples
folder. When pressing keys, the KeyPress message is sent 2 times (KeyEventKind::Pressed
andKeyEventKind::Released
). This results in the counter being incremented twice, instead of once.Expected behaviour
The user should be able to define the
KeyEventKind
when listening forKeyEvent
to avoid receiving twice the sameKeyEvent
message.Environment
Additional information
See this issue for reference and more information. The actual docs for the
KeyEvent
in crossterm are here.Fix (?)
I think changing the struct of
KeyEvent
to allow to specifyKeyEventKind
and passing it to crossterm would work.The text was updated successfully, but these errors were encountered: