mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-24 19:47:41 +03:00
Refactor slightly
This commit is contained in:
parent
29ac441c3b
commit
4ed3c5de48
@ -31,9 +31,9 @@ class KeyUtils {
|
||||
return false
|
||||
}
|
||||
|
||||
static func namedKeyFrom(key: String) -> String {
|
||||
if let firstChar = key.utf16.first, specialKeys.keys.contains(Int(firstChar)) {
|
||||
return specialKeys[Int(firstChar)]!
|
||||
static func namedKey(from key: String) -> String {
|
||||
if let firstChar = key.utf16.first, let special = specialKeys[Int(firstChar)] {
|
||||
return special
|
||||
}
|
||||
|
||||
return key
|
||||
|
@ -33,7 +33,7 @@ extension NeoVimView {
|
||||
let isPlain = flags.isEmpty && !isNamedKey
|
||||
let isWrapNeeded = !isControlCode && !isPlain
|
||||
|
||||
let namedChars = KeyUtils.namedKeyFrom(key: charsIgnoringModifiers)
|
||||
let namedChars = KeyUtils.namedKey(from: charsIgnoringModifiers)
|
||||
let finalInput = isWrapNeeded
|
||||
? self.wrapNamedKeys(flags + namedChars)
|
||||
: self.vimPlainString(chars)
|
||||
|
Loading…
Reference in New Issue
Block a user