1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-29 03:53:38 +03:00

Support shift modifier on special keys

The NeoVimView.vimModifierFlags method only checks for the control, option, and command modifiers, which leads to the shift modifier getting lost.
This change mitigates that by checking for the shift modifier and translating it to the `S-` key prefix.

This change has the possible side effect of requiring additional `S-` prefixes, depending on the keyboard layout.
For example, take a US keyboard with a <kbd>-</kbd>/<kbd>_</kbd> key and press that key with control and shift depressed.
Before this change, VimR would transmit `<C-_>`, while after this change it transmits `<C-S-_>`.
This commit is contained in:
Martin Kühl 2017-05-17 14:16:01 +02:00
parent a27001ab7f
commit bbce00c6ef

View File

@ -1036,6 +1036,7 @@ extension NeoVimView: NSTextInputClient {
let control = modifierFlags.contains(.control)
let option = modifierFlags.contains(.option)
let command = modifierFlags.contains(.command)
let shift = modifierFlags.contains(.shift)
if control {
result += "C-"
@ -1049,6 +1050,10 @@ extension NeoVimView: NSTextInputClient {
result += "D-"
}
if shift {
result += "S-"
}
if result.characters.count > 0 {
return result
}