Files
ghostty/macos/Sources/Features/Terminal/TerminalRestorableState+InteralState.swift
Jon Parise 33adb58bee macos: remove unneeded initializers
These will be automatically synthesized (they only do memberwise
initialization) and do not need to be manually defined.
2026-05-31 09:54:41 -04:00

32 lines
1.2 KiB
Swift

import AppKit
extension TerminalRestorableState {
/// Internal State we use to perform unit tests
///
/// Since we can't really change the type of `TerminalRestorableState`
/// due to `CodableBridge<TerminalRestorableState>` supporting secure coding,
/// we use an internal type to perform migration and tests
struct InternalState<ViewType: NSView & Codable & Identifiable>: Codable {
// MARK: - Version 5 (1.2.3)
let focusedSurface: String?
let surfaceTree: SplitTree<ViewType>
// MARK: - Version 7 (1.3.0)
let effectiveFullscreenMode: FullscreenMode?
let tabColor: TerminalTabColor?
let titleOverride: String?
}
}
extension TerminalRestorableState.InternalState where ViewType == Ghostty.SurfaceView {
init(from controller: TerminalController) {
self.init(
focusedSurface: controller.focusedSurface?.id.uuidString,
surfaceTree: controller.surfaceTree,
effectiveFullscreenMode: controller.fullscreenStyle?.fullscreenMode,
tabColor: (controller.window as? TerminalWindow)?.tabColor,
titleOverride: controller.titleOverride,
)
}
}