1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-24 19:47:41 +03:00

Refactor slightly

This commit is contained in:
Tae Won Ha 2017-08-26 09:26:45 +02:00
parent 29ac441c3b
commit 4ed3c5de48
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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)