mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-28 11:35:35 +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
|
||||
}
|
||||
|
||||
|
@ -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