mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-24 11:37:32 +03:00
Refactor slightly
This commit is contained in:
parent
3b6ab29b94
commit
4851005aac
@ -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) {
|
||||
|
@ -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?
|
||||
|
Loading…
Reference in New Issue
Block a user