mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-25 06:06:21 +03:00
Add Control Code \0 handling
This commit is contained in:
parent
38840c5c58
commit
66f36e2974
@ -78,19 +78,30 @@ extension NeoVimView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override public func performKeyEquivalent(with event: NSEvent) -> Bool {
|
override public func performKeyEquivalent(with event: NSEvent) -> Bool {
|
||||||
let type = event.type
|
if .keyDown != event.type { return false }
|
||||||
let flags = event.modifierFlags
|
let flags = event.modifierFlags.intersection(.deviceIndependentFlagsMask)
|
||||||
|
|
||||||
/* <C-Tab> & <C-S-Tab> do not trigger keyDown events.
|
/* <C-Tab> & <C-S-Tab> do not trigger keyDown events.
|
||||||
Catch the key event here and pass it to keyDown.
|
Catch the key event here and pass it to keyDown.
|
||||||
(By rogual in NeoVim dot app
|
(By rogual in NeoVim dot app
|
||||||
https://github.com/rogual/neovim-dot-app/pull/248/files )
|
https://github.com/rogual/neovim-dot-app/pull/248/files )
|
||||||
*/
|
*/
|
||||||
if .keyDown == type && flags.contains(.control) && 48 == event.keyCode {
|
if flags.contains(.control) && 48 == event.keyCode {
|
||||||
self.keyDown(with: event)
|
self.keyDown(with: event)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guard let chars = event.characters else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Control code \0 causes rpc parsing problems.
|
||||||
|
// So we escape as early as possible
|
||||||
|
if chars == "\0" {
|
||||||
|
self.agent.vimInput(self.wrapNamedKeys("Nul"))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user