rime / squirrel

【鼠鬚管】Rime for macOS
https://rime.im
GNU General Public License v3.0
4.52k stars 412 forks source link

Use keyCode before defaulting to unrecognized rime keycode #936

Closed LEOYoon-Tsaw closed 1 week ago

LEOYoon-Tsaw commented 1 month ago

Sometimes (e.g. in ABC Extended keyboard layout), Option + certain keys gives modifier letters, even with NSEvent.charactersIgnoringModifiers

For example, +6 gives U+02C6 "MODIFIER LETTER CIRCUMFLEX ACCENT"

Thus in these keyboard layouts, shortcuts like +6 will never work with Rime.

This proposal try to use raw key code before defaulting to unrecognized symbols, so that although Rime doesn't recognize U+02C6 as a key char, but instead, we use the key code of 6 for processing.

Testing: It works for the stated purpose, +6 works in ABC - Extended keyboard layout.

LEOYoon-Tsaw commented 1 month ago

@lotem you have a big stock of keyboards, do you think it is going to lead to unwanted side effects

lotem commented 1 month ago

test other layouts like dvorak French azerty

LEOYoon-Tsaw commented 1 month ago

I tried French AZERTY keyboard, it works well. But this is software switch, I don't know if a physically different keyboard will behave the same way

lotem commented 1 week ago

All modern physical keyboards speak the same protocol.

lotem commented 1 week ago

In R2ime the user's program need to clarify whether the key code or character is processed.

LEOYoon-Tsaw commented 1 week ago

Then I'll proceed with this PR, while looking forward to R²ime