mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-29 16:56:40 +03:00
Make special keys file private
This commit is contained in:
parent
5430834773
commit
53bed4540a
@ -7,7 +7,28 @@ import Cocoa
|
||||
|
||||
class KeyUtils {
|
||||
|
||||
static let specialKeys = [
|
||||
static func isSpecial(key: String) -> Bool {
|
||||
guard key.characters.count == 1 else {
|
||||
return false
|
||||
}
|
||||
|
||||
if let firstChar = key.utf16.first {
|
||||
return specialKeys.keys.contains(Int(firstChar))
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
static func namedKeyFrom(key: String) -> String {
|
||||
if let firstChar = key.utf16.first, specialKeys.keys.contains(Int(firstChar)) {
|
||||
return specialKeys[Int(firstChar)]!
|
||||
}
|
||||
|
||||
return key
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate let specialKeys = [
|
||||
NSUpArrowFunctionKey: "Up",
|
||||
NSDownArrowFunctionKey: "Down",
|
||||
NSLeftArrowFunctionKey: "Left",
|
||||
@ -58,26 +79,3 @@ class KeyUtils {
|
||||
NSF35FunctionKey: "F35",
|
||||
0x19: "Tab",
|
||||
]
|
||||
|
||||
static func isSpecial(key: String) -> Bool {
|
||||
guard key.characters.count == 1 else {
|
||||
return false
|
||||
}
|
||||
|
||||
if let firstChar = key.utf16.first {
|
||||
return KeyUtils.specialKeys.keys.contains(Int(firstChar))
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
static func namedKeyFrom(key: String) -> String {
|
||||
if let firstChar = key.utf16.first {
|
||||
if KeyUtils.specialKeys.keys.contains(Int(firstChar)) {
|
||||
return KeyUtils.specialKeys[Int(firstChar)]!
|
||||
}
|
||||
}
|
||||
|
||||
return key
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user