crossterm-rs / crossterm

Cross platform terminal library rust
MIT License
3.27k stars 280 forks source link

Key stroke listener, windows vs mac os #769

Closed lcmgh closed 1 year ago

lcmgh commented 1 year ago

Hi!

I am using this code taken from the tui crate examples https://github.com/fdehau/tui-rs/blob/master/examples/demo/crossterm.rs#L45 to listen for Key events. However the behavior on Mac OS vs. Windows is different. While on MacOS one can easily navigate Windows users report that when they type a key they move across two menu entries instead of one.

Do you have any idea why this is the case?

Thanks

sigmaSd commented 1 year ago

https://github.com/crossterm-rs/crossterm/issues/752

lesleyrs commented 1 year ago

This one is more related to https://github.com/crossterm-rs/crossterm/issues/772#issuecomment-1498380935.

You need to check for KeyEventKind, either press or release. I think currently mac and linux only show presses right now?

lcmgh commented 1 year ago

My problem was solved by downgrading the version to 0.25.0.