mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-29 00:34:26 +03:00
GH-325 Refactor slightly
This commit is contained in:
parent
3237dd23f7
commit
ab21bb767e
@ -132,6 +132,8 @@ extension AppDelegate {
|
||||
}
|
||||
|
||||
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplicationTerminateReply {
|
||||
self.stateContext.savePrefs()
|
||||
|
||||
if self.hasDirtyWindows && self.hasMainWindows {
|
||||
let alert = NSAlert()
|
||||
alert.addButton(withTitle: "Cancel")
|
||||
@ -141,7 +143,6 @@ extension AppDelegate {
|
||||
|
||||
if alert.runModal() == NSAlertSecondButtonReturn {
|
||||
self.uiRoot.prepareQuit()
|
||||
self.stateContext.savePrefs()
|
||||
return .terminateNow
|
||||
}
|
||||
|
||||
@ -150,12 +151,10 @@ extension AppDelegate {
|
||||
|
||||
if self.hasMainWindows {
|
||||
self.uiRoot.prepareQuit()
|
||||
self.stateContext.savePrefs()
|
||||
return .terminateNow
|
||||
}
|
||||
|
||||
// There are no open main window, then just quit.
|
||||
self.stateContext.savePrefs()
|
||||
return .terminateNow
|
||||
}
|
||||
|
||||
@ -314,4 +313,4 @@ fileprivate let filePrefix = "file="
|
||||
fileprivate let cwdPrefix = "cwd="
|
||||
fileprivate let nvimArgsPrefix = "nvim-args="
|
||||
fileprivate let pipePathPrefix = "pipe-path="
|
||||
fileprivate let waitPrefix = "wait="
|
||||
fileprivate let waitPrefix = "wait="
|
||||
|
@ -68,14 +68,9 @@ class AppDelegateReducer {
|
||||
|
||||
mainWindow.nvimArgs = nvimArgs
|
||||
mainWindow.cliPipePath = cliPipePath
|
||||
|
||||
mainWindow.urlsToOpen = urls.toDict { _ in MainWindow.OpenMode.default }
|
||||
|
||||
if state.mainWindows.isEmpty {
|
||||
return mainWindow
|
||||
}
|
||||
|
||||
mainWindow.frame = self.frame(relativeTo: state.mainWindowTemplate.frame)
|
||||
mainWindow.frame = state.mainWindows.isEmpty ? state.mainWindowTemplate.frame
|
||||
: self.frame(relativeTo: state.mainWindowTemplate.frame)
|
||||
|
||||
return mainWindow
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ extension MainWindow {
|
||||
self.useInteractiveZsh = PrefUtils.bool(from: dict, for: Keys.MainWindow.useInteractiveZsh, default: false)
|
||||
let frameString = PrefUtils.string(from: dict,
|
||||
for: Keys.MainWindow.frame,
|
||||
default: NSStringFromRect(CGRect(x: 100, y: 100, width: 600, height: 400)))
|
||||
default: NSStringFromRect(self.frame))
|
||||
self.frame = NSRectFromString(frameString)
|
||||
|
||||
self.isAllToolsVisible = isAllToolsVisible
|
||||
|
Loading…
Reference in New Issue
Block a user