pc-keyboard
pc-keyboard copied to clipboard
Inconsistent decoding
Your crate decodes some keys into DecodedKey::RawKey
objects. The enum
that you provide containing keys has a Backspace
variant, but, using QEmu as my example, a backspace is decoded into unicode U+0008
, and as a DecodedKey::Unicode
.
That's because I understood 0x08 to be the ASCII value for Backspace, like 0x09 is the ASCII value for Tab. I only used DecodedKey::RawKey
when there wasn't a clear mapping to an ASCII (or Unicode) value (e.g. there's no ASCII or even Unicode value corresponding to the Windows key). If you'd rather have raw key events (i.e. the KeyCode
enum you mention that includes KeyCode::Backspace
, plus an indication of whether the key was pressed or released), you can avoid calling process_keyevent
and handle the key events yourself.
Then can we remove the Backspace
variant of the enum, as it is not used, and only use ASCII Backspace
It is used if you take KeyEvents and don't decode them.
I can see your point though. I could create a new enum called UndecodableKeys or something. It would include Home, PageUp, etc, but not A, +, or Backspace. You can then match exhaustively without overlaps.