Closed vinc closed 4 years ago
So the deal with Control + Key
is that Control + A
gives 1 (0x01), Control + B
gives 2 (0x02), and Control + Z
gives 26 (0x1A).
I think following the principle of Least Surprise would mean that Control + C would do a 'Copy' function, no matter where on the keyboard the 'C' key was. I therefore propose we change the Dvorak mapping so that Control + Letter
gives the correct control code for the letter printed on the key, as opposed to the letter at the corresponding position on the US keyboard (i.e. the KeyCode
).
This diff also highlights the issue with naming the KeyCode
letter keys after the letter they have on a US keyboard, but I can't think of anything better to use - mapping Key R
to Unicode character P
seems marginally less confusing than mapping Key 19 to P
.
Thanks, I'll change the Control modifiers, it's indeed much better!
For the KeyCode
naming I think it's good as it is, personally I didn't think it confusing because my keyboards are either blank or azerty, so I'm used to having a mental image of a physical US keyboard then remapping it to the actual output I want.
I changed the modifiers so that pressing CTRL with the key that produce a C for example will result in CTRL+C as expected. And while I was doing that I noticed that you are using is_caps()
for upper-case letters and is_shifted
for symbols, so I did the same.
Thank you so much!
Hello, I started coding a toy OS and your crate is really helpful, thanks!
I use a Dvorak layout so I created one by copying the US 104 layout and keeping only the diff, like the code of the UK 105 layout does.
I didn't change any of the
ctrl
modifiers, not sure if I should? I don't use that on my keyboards so I don't really know.