crossterm-rs / crossterm

Cross platform terminal library rust
MIT License
3.28k stars 281 forks source link

Inconsistent key event of "shifted" characters between Windows and Linux #822

Open ndtoan96 opened 1 year ago

ndtoan96 commented 1 year ago

Describe the bug Inconsistent key event of "shifted" characters between Windows and Linux

To Reproduce Steps to reproduce the behavior:

  1. Run the official example of crossterm key event: https://docs.rs/crossterm/latest/crossterm/event/index.html
  2. On US layout keyboard, press Shift + a then Shift + /
  3. See the difference in below table
Key Windows Linux
Shift + a Char('A') + SHIFT Char('A') + SHIFT
Shift + / Char('?') + SHIFT Char('?') + 0x0

Expected behavior

  1. I expect that the same key press will produce the same key event regardless of OS
  2. I expect in the case of Linux, when pressing Shift + key, the behavior is consistent. You can see in the table above, I got a SHIFT with Shift + a but I got 0x0 with Shift + /.

OS Windows and Kali Linux

Terminal/Console

SaumitraLohokare commented 3 days ago

Also, pressing Ctrl + Shift + s gives different results on Windows and Linux.

Windows: Char('S') + CONTROL | SHIFT Linux: Char('s') + CONTROL

The s is also not capitalized on Linux with Ctrl + Shift + s