diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index 0f14db895c4..fedc669f24f 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -1850,13 +1850,19 @@ class TerminalController: BaseTerminalController, TabGroupCloseCoordinator.Contr ) if let window = window as? TerminalWindow { window.titlebarFont = lastTitlebarFont + window.setDiffSidebarButtonState(willShow) } } } @objc func closeGitDiff(_ sender: Any?) { guard #available(macOS 26.0, *) else { return } - Task { await gitDiffSidebarState.setVisible(false, cwd: nil) } + Task { + await gitDiffSidebarState.setVisible(false, cwd: nil) + if let window = window as? TerminalWindow { + window.setDiffSidebarButtonState(false) + } + } } @objc func openInEditor(_ sender: Any?) { diff --git a/macos/Sources/Features/Terminal/Window Styles/TerminalWindow.swift b/macos/Sources/Features/Terminal/Window Styles/TerminalWindow.swift index eac127a2437..b562ee78556 100644 --- a/macos/Sources/Features/Terminal/Window Styles/TerminalWindow.swift +++ b/macos/Sources/Features/Terminal/Window Styles/TerminalWindow.swift @@ -38,11 +38,11 @@ class TerminalWindow: NSWindow { private(set) var derivedConfig: DerivedConfig = .init() /// Sets up our tab context menu - private var tabMenuObserver: NSObjectProtocol? = nil - private var titlebarFontTabGroupObservation: NSKeyValueObservation? = nil - private var titlebarFontTabBarObservation: NSKeyValueObservation? = nil - private var lastTitlebarFontState: TitlebarFontState? = nil - private var lastAppliedAppearance: AppearanceState? = nil + private var tabMenuObserver: NSObjectProtocol? + private var titlebarFontTabGroupObservation: NSKeyValueObservation? + private var titlebarFontTabBarObservation: NSKeyValueObservation? + private var lastTitlebarFontState: TitlebarFontState? + private var lastAppliedAppearance: AppearanceState? /// Whether this window supports the update accessory. If this is false, then views within this /// window should determine how to show update notifications. @@ -178,7 +178,7 @@ class TerminalWindow: NSWindow { button.controlSize = .large button.target = terminalController button.action = #selector(TerminalController.toggleGitDiffSidebar(_:)) - button.setButtonType(.momentaryPushIn) + button.setButtonType(.pushOnPushOff) container.addSubview(button) NSLayoutConstraint.activate([ @@ -452,6 +452,13 @@ class TerminalWindow: NSWindow { return label }() + // MARK: Diff Sidebar Toggle + + /// Update the diff sidebar toggle button to reflect visibility state. + func setDiffSidebarButtonState(_ isOn: Bool) { + diffSidebarButton?.state = isOn ? .on : .off + } + // MARK: Surface Zoom /// Set to true if a surface is currently zoomed to show the reset zoom button.