From eada6f95ba65985965ca0ff98fadf0931ab093cc Mon Sep 17 00:00:00 2001 From: Ezequiel Rosas Date: Thu, 27 Jul 2017 21:40:02 -0500 Subject: [PATCH] Add becomeMain & resignMain methods --- SwiftNeoVim/NeoVimView+Key.swift | 8 ++++++++ VimR/MainWindow.swift | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/SwiftNeoVim/NeoVimView+Key.swift b/SwiftNeoVim/NeoVimView+Key.swift index e9b28069..c442b55c 100644 --- a/SwiftNeoVim/NeoVimView+Key.swift +++ b/SwiftNeoVim/NeoVimView+Key.swift @@ -229,4 +229,12 @@ extension NeoVimView { return nil } + + public func didBecomeMain() { + self.agent.vimInput("") + } + + public func didResignMain() { + self.agent.vimInput("") + } } diff --git a/VimR/MainWindow.swift b/VimR/MainWindow.swift index 1be2574f..dd2a284a 100644 --- a/VimR/MainWindow.swift +++ b/VimR/MainWindow.swift @@ -491,6 +491,14 @@ extension MainWindow { self.emit(self.uuidAction(for: .becomeKey)) } + func windowDidBecomeMain(_ notification: Notification) { + self.neoVimView.didBecomeMain() + } + + func windowDidResignMain(_ notification: Notification) { + self.neoVimView.didResignMain() + } + func windowShouldClose(_: Any) -> Bool { guard self.neoVimView.isCurrentBufferDirty() else { self.neoVimView.closeCurrentTab()