mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-24 03:25:03 +03:00
Do not resize in init
This commit is contained in:
parent
698b0ceff8
commit
702a1b461d
@ -185,21 +185,17 @@ public class NeoVimView: NSView, NeoVimUiBridgeProtocol, NSUserInterfaceValidati
|
|||||||
let noErrorDuringInitialization = self.agent.runLocalServerAndNeoVim()
|
let noErrorDuringInitialization = self.agent.runLocalServerAndNeoVim()
|
||||||
|
|
||||||
// Neovim is ready now: resize neovim to bounds.
|
// Neovim is ready now: resize neovim to bounds.
|
||||||
DispatchQueue.main.async {
|
self.agent.vimCommand("set mouse=a")
|
||||||
self.agent.vimCommand("set mouse=a")
|
self.agent.setBoolOption("title", to: true)
|
||||||
self.agent.setBoolOption("title", to: true)
|
self.agent.setBoolOption("termguicolors", to: true)
|
||||||
self.agent.setBoolOption("termguicolors", to: true)
|
|
||||||
|
|
||||||
if noErrorDuringInitialization == false {
|
if noErrorDuringInitialization == false {
|
||||||
let alert = NSAlert()
|
let alert = NSAlert()
|
||||||
alert.alertStyle = .warning
|
alert.alertStyle = .warning
|
||||||
alert.messageText = "Error during initialization"
|
alert.messageText = "Error during initialization"
|
||||||
alert.informativeText = "There was an error during the initialization of NeoVim. "
|
alert.informativeText = "There was an error during the initialization of NeoVim. "
|
||||||
+ "Use :messages to view the error messages."
|
+ "Use :messages to view the error messages."
|
||||||
alert.runModal()
|
alert.runModal()
|
||||||
}
|
|
||||||
|
|
||||||
self.resizeNeoVimUiTo(size: self.bounds.size)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,13 +224,17 @@ public class NeoVimView: NSView, NeoVimUiBridgeProtocol, NSUserInterfaceValidati
|
|||||||
self.descent = self.drawer.descent
|
self.descent = self.drawer.descent
|
||||||
self.leading = self.drawer.leading
|
self.leading = self.drawer.leading
|
||||||
|
|
||||||
self.resizeNeoVimUiTo(size: self.bounds.size)
|
self.resizeNeoVimUi(to: self.bounds.size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - API
|
// MARK: - API
|
||||||
extension NeoVimView {
|
extension NeoVimView {
|
||||||
|
|
||||||
|
public func syncNeoVimWithBounds() {
|
||||||
|
self.resizeNeoVimUi(to: self.bounds.size)
|
||||||
|
}
|
||||||
|
|
||||||
public func enterResizeMode() {
|
public func enterResizeMode() {
|
||||||
self.currentlyResizing = true
|
self.currentlyResizing = true
|
||||||
self.needsDisplay = true
|
self.needsDisplay = true
|
||||||
@ -243,7 +243,7 @@ extension NeoVimView {
|
|||||||
public func exitResizeMode() {
|
public func exitResizeMode() {
|
||||||
self.currentlyResizing = false
|
self.currentlyResizing = false
|
||||||
self.needsDisplay = true
|
self.needsDisplay = true
|
||||||
self.resizeNeoVimUiTo(size: self.bounds.size)
|
self.resizeNeoVimUi(to: self.bounds.size)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -397,21 +397,21 @@ extension NeoVimView {
|
|||||||
|
|
||||||
if self.inLiveResize || self.currentlyResizing {
|
if self.inLiveResize || self.currentlyResizing {
|
||||||
// TODO: Turn off live resizing for now.
|
// TODO: Turn off live resizing for now.
|
||||||
// self.resizeNeoVimUiTo(size: newSize)
|
// self.resizeNeoVimUi(to: newSize)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// There can be cases where the frame is resized not by live resizing, eg when the window is resized by window
|
// There can be cases where the frame is resized not by live resizing, eg when the window is resized by window
|
||||||
// management tools. Thus, we make sure that the resize call is made when this happens.
|
// management tools. Thus, we make sure that the resize call is made when this happens.
|
||||||
self.resizeNeoVimUiTo(size: newSize)
|
self.resizeNeoVimUi(to: newSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
override public func viewDidEndLiveResize() {
|
override public func viewDidEndLiveResize() {
|
||||||
super.viewDidEndLiveResize()
|
super.viewDidEndLiveResize()
|
||||||
self.resizeNeoVimUiTo(size: self.bounds.size)
|
self.resizeNeoVimUi(to: self.bounds.size)
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func resizeNeoVimUiTo(size: CGSize) {
|
fileprivate func resizeNeoVimUi(to size: CGSize) {
|
||||||
self.currentEmoji = self.randomEmoji()
|
self.currentEmoji = self.randomEmoji()
|
||||||
|
|
||||||
// NSLog("\(#function): \(size)")
|
// NSLog("\(#function): \(size)")
|
||||||
|
@ -234,6 +234,7 @@ class MainWindow: NSObject,
|
|||||||
self.open(urls: state.urlsToOpen)
|
self.open(urls: state.urlsToOpen)
|
||||||
|
|
||||||
self.window.makeFirstResponder(self.neoVimView)
|
self.window.makeFirstResponder(self.neoVimView)
|
||||||
|
self.neoVimView.syncNeoVimWithBounds()
|
||||||
}
|
}
|
||||||
|
|
||||||
func show() {
|
func show() {
|
||||||
|
Loading…
Reference in New Issue
Block a user