Consolidate code that existed twice and drop code nothing reaches.
- SSH: hoist the duplicated ASCII hex-nibble decoder out of
RemoteCharsetConverter and SSHPTYChannel into SSHWireEncoding.hexDigit.
- Transcript: AgentToolDetail.Tint shares BatchTint's vocabulary, so the
byte-identical detailColor map now delegates to batchColor.
- Commerce: replace ProPaywallState's unreachable default branch and its
`preconditionFailure("Handled above")` with an exhaustive switch the
compiler can prove complete.
- Strings: delete the unreferenced Workspace.closePaneAction (the live help
text uses closePane) and its orphan catalog entry.
- Drop the unused SwiftData and UniformTypeIdentifiers imports.
Co-Authored-By: Claude Code <noreply@anthropic.com>
33 lines
1.9 KiB
Swift
33 lines
1.9 KiB
Swift
import Foundation
|
|
import TermindApplication
|
|
import TermindDomain
|
|
|
|
extension TerminalPreferences {
|
|
public nonisolated init(defaults: UserDefaults) {
|
|
self.init()
|
|
darkTheme = defaults.string(forKey: SettingsKey.terminalThemeDark) ?? darkTheme
|
|
lightTheme = defaults.string(forKey: SettingsKey.terminalThemeLight) ?? lightTheme
|
|
darkCustomEnabled =
|
|
defaults.object(forKey: SettingsKey.terminalCustomConfigurationDarkEnabled) as? Bool ?? false
|
|
lightCustomEnabled =
|
|
defaults.object(forKey: SettingsKey.terminalCustomConfigurationLightEnabled) as? Bool ?? false
|
|
darkCustomConfiguration = defaults.string(forKey: SettingsKey.terminalCustomConfigurationDark) ?? ""
|
|
lightCustomConfiguration = defaults.string(forKey: SettingsKey.terminalCustomConfigurationLight) ?? ""
|
|
shellIntegration = defaults.object(forKey: SettingsKey.shellIntegration) as? Bool ?? shellIntegration
|
|
copyOnSelect = defaults.bool(forKey: SettingsKey.terminalCopyOnSelect)
|
|
pasteOnRightClick = defaults.bool(forKey: SettingsKey.terminalPasteOnRightClick)
|
|
}
|
|
|
|
public nonisolated func mirror(to defaults: UserDefaults) {
|
|
defaults.set(darkTheme, forKey: SettingsKey.terminalThemeDark)
|
|
defaults.set(lightTheme, forKey: SettingsKey.terminalThemeLight)
|
|
defaults.set(darkCustomEnabled, forKey: SettingsKey.terminalCustomConfigurationDarkEnabled)
|
|
defaults.set(lightCustomEnabled, forKey: SettingsKey.terminalCustomConfigurationLightEnabled)
|
|
defaults.set(darkCustomConfiguration, forKey: SettingsKey.terminalCustomConfigurationDark)
|
|
defaults.set(lightCustomConfiguration, forKey: SettingsKey.terminalCustomConfigurationLight)
|
|
defaults.set(shellIntegration, forKey: SettingsKey.shellIntegration)
|
|
defaults.set(copyOnSelect, forKey: SettingsKey.terminalCopyOnSelect)
|
|
defaults.set(pasteOnRightClick, forKey: SettingsKey.terminalPasteOnRightClick)
|
|
}
|
|
}
|