From bbce00c6ef9ab6e790c6d81124911409add35811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ku=CC=88hl?= Date: Wed, 17 May 2017 14:16:01 +0200 Subject: [PATCH] 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 -/_ key and press that key with control and shift depressed. Before this change, VimR would transmit ``, while after this change it transmits ``. --- SwiftNeoVim/NeoVimView.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SwiftNeoVim/NeoVimView.swift b/SwiftNeoVim/NeoVimView.swift index af969f6a..7bb44487 100644 --- a/SwiftNeoVim/NeoVimView.swift +++ b/SwiftNeoVim/NeoVimView.swift @@ -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 }