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

Refactor slightly

This commit is contained in:
Tae Won Ha 2018-01-22 20:15:52 +01:00
parent 3b6ab29b94
commit 4851005aac
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
2 changed files with 10 additions and 10 deletions

View File

@ -174,7 +174,7 @@ public class NvimView: NSView,
public init(frame rect: NSRect, config: Config) {
self.drawer = TextDrawer(font: self._font)
self.uiBridge = UiBridge(uuid: self.uuid)
self.uiBridge = UiBridge(uuid: self.uuid, config: config)
let sockPath = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("vimr_\(self.uuid).sock").path
guard let nvim = NvimApi(at: sockPath) else {
@ -193,9 +193,6 @@ public class NvimView: NSView,
// We cannot set bridge in init since self is not available before super.init()...
self.uiBridge.nvimView = self
self.uiBridge.useInteractiveZsh = config.useInteractiveZsh
self.uiBridge.cwd = config.cwd
self.uiBridge.nvimArgs = config.nvimArgs ?? []
}
convenience override public init(frame rect: NSRect) {

View File

@ -13,15 +13,14 @@ class UiBridge {
var isNvimQuit = false
let nvimQuitCondition = NSCondition()
var useInteractiveZsh = false
var cwd = URL(fileURLWithPath: NSHomeDirectory())
var nvimArgs = [String]()
init(uuid: String) {
init(uuid: String, config: NvimView.Config) {
self.uuid = uuid
self.messageHandler = MessageHandler()
self.useInteractiveZsh = config.useInteractiveZsh
self.nvimArgs = config.nvimArgs ?? []
self.cwd = config.cwd
self.messageHandler.bridge = self
}
@ -416,6 +415,10 @@ class UiBridge {
private let uuid: String
private let useInteractiveZsh: Bool
private let cwd: URL
private var nvimArgs: [String]
private var remoteServerPort: CFMessagePort?
private var localServerPort: CFMessagePort?