mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-25 23:02:35 +03:00
GH-325 Do not store full screen frame in user defaults
This commit is contained in:
parent
feb4eae765
commit
b9a4bb157f
@ -46,7 +46,7 @@ class MainWindow: NSObject,
|
||||
case setCurrentBuffer(NeoVimBuffer)
|
||||
case setDirtyStatus(Bool)
|
||||
|
||||
case becomeKey
|
||||
case becomeKey(isFullScreen: Bool)
|
||||
case frameChanged(to: CGRect)
|
||||
|
||||
case scroll(to: Marked<Position>)
|
||||
@ -500,7 +500,7 @@ extension MainWindow {
|
||||
extension MainWindow {
|
||||
|
||||
func windowDidBecomeMain(_ notification: Notification) {
|
||||
self.emit(self.uuidAction(for: .becomeKey))
|
||||
self.emit(self.uuidAction(for: .becomeKey(isFullScreen: self.window.styleMask.contains(.fullScreen))))
|
||||
self.neoVimView.didBecomeMain()
|
||||
}
|
||||
|
||||
@ -513,6 +513,10 @@ extension MainWindow {
|
||||
}
|
||||
|
||||
func windowDidResize(_ notification: Notification) {
|
||||
if self.window.styleMask.contains(.fullScreen) {
|
||||
return
|
||||
}
|
||||
|
||||
self.emit(self.uuidAction(for: .frameChanged(to: self.window.frame)))
|
||||
}
|
||||
|
||||
|
@ -15,10 +15,12 @@ class UiRootReducer {
|
||||
|
||||
switch pair.action.payload {
|
||||
|
||||
case .becomeKey:
|
||||
case let .becomeKey(isFullScreen):
|
||||
appState.currentMainWindowUuid = uuid
|
||||
appState.mainWindowTemplate = self.mainWindowTemplate(
|
||||
from: appState.mainWindowTemplate, new: appState.mainWindows[uuid] ?? appState.mainWindowTemplate
|
||||
from: appState.mainWindowTemplate,
|
||||
new: appState.mainWindows[uuid] ?? appState.mainWindowTemplate,
|
||||
isFullScreen: isFullScreen
|
||||
)
|
||||
|
||||
case let .frameChanged(to: frame):
|
||||
@ -38,7 +40,8 @@ class UiRootReducer {
|
||||
case .close:
|
||||
if appState.currentMainWindowUuid == uuid, let mainWindowToClose = appState.mainWindows[uuid] {
|
||||
appState.mainWindowTemplate = self.mainWindowTemplate(from: appState.mainWindowTemplate,
|
||||
new: mainWindowToClose)
|
||||
new: mainWindowToClose,
|
||||
isFullScreen: false)
|
||||
|
||||
appState.currentMainWindowUuid = nil
|
||||
}
|
||||
@ -56,10 +59,15 @@ class UiRootReducer {
|
||||
return StateActionPair(state: appState, action: pair.action)
|
||||
}
|
||||
|
||||
fileprivate func mainWindowTemplate(from old: MainWindow.State, new: MainWindow.State) -> MainWindow.State {
|
||||
fileprivate func mainWindowTemplate(from old: MainWindow.State,
|
||||
new: MainWindow.State,
|
||||
isFullScreen: Bool) -> MainWindow.State {
|
||||
|
||||
var result = old
|
||||
|
||||
result.frame = new.frame
|
||||
if !isFullScreen {
|
||||
result.frame = new.frame
|
||||
}
|
||||
|
||||
result.isAllToolsVisible = new.isAllToolsVisible
|
||||
result.isToolButtonsVisible = new.isToolButtonsVisible
|
||||
|
Loading…
Reference in New Issue
Block a user