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

Merge pull request #494 from nhtzr/add-fgevent

Add becomeMain & resignMain methods
This commit is contained in:
Tae Won Ha 2017-08-11 14:48:36 +02:00 committed by GitHub
commit eb406668a2
2 changed files with 16 additions and 0 deletions

View File

@ -247,4 +247,12 @@ extension NeoVimView {
return nil return nil
} }
public func didBecomeMain() {
self.agent.vimInput("<FocusGained>")
}
public func didResignMain() {
self.agent.vimInput("<FocusLost>")
}
} }

View File

@ -491,6 +491,14 @@ extension MainWindow {
self.emit(self.uuidAction(for: .becomeKey)) self.emit(self.uuidAction(for: .becomeKey))
} }
func windowDidBecomeMain(_ notification: Notification) {
self.neoVimView.didBecomeMain()
}
func windowDidResignMain(_ notification: Notification) {
self.neoVimView.didResignMain()
}
func windowShouldClose(_: Any) -> Bool { func windowShouldClose(_: Any) -> Bool {
guard self.neoVimView.isCurrentBufferDirty() else { guard self.neoVimView.isCurrentBufferDirty() else {
self.neoVimView.closeCurrentTab() self.neoVimView.closeCurrentTab()