Skip to content

Commit 28a7b58

Browse files
authored
Merge pull request #7 from bvolpato-dd/bv/code-changes-toggle
macos: make diff sidebar button a visual toggle
2 parents 2149583 + 29d0725 commit 28a7b58

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

macos/Sources/Features/Terminal/TerminalController.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1850,13 +1850,19 @@ class TerminalController: BaseTerminalController, TabGroupCloseCoordinator.Contr
18501850
)
18511851
if let window = window as? TerminalWindow {
18521852
window.titlebarFont = lastTitlebarFont
1853+
window.setDiffSidebarButtonState(willShow)
18531854
}
18541855
}
18551856
}
18561857

18571858
@objc func closeGitDiff(_ sender: Any?) {
18581859
guard #available(macOS 26.0, *) else { return }
1859-
Task { await gitDiffSidebarState.setVisible(false, cwd: nil) }
1860+
Task {
1861+
await gitDiffSidebarState.setVisible(false, cwd: nil)
1862+
if let window = window as? TerminalWindow {
1863+
window.setDiffSidebarButtonState(false)
1864+
}
1865+
}
18601866
}
18611867

18621868
@objc func openInEditor(_ sender: Any?) {

macos/Sources/Features/Terminal/Window Styles/TerminalWindow.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class TerminalWindow: NSWindow {
178178
button.controlSize = .large
179179
button.target = terminalController
180180
button.action = #selector(TerminalController.toggleGitDiffSidebar(_:))
181-
button.setButtonType(.momentaryPushIn)
181+
button.setButtonType(.pushOnPushOff)
182182

183183
container.addSubview(button)
184184
NSLayoutConstraint.activate([
@@ -452,6 +452,13 @@ class TerminalWindow: NSWindow {
452452
return label
453453
}()
454454

455+
// MARK: Diff Sidebar Toggle
456+
457+
/// Update the diff sidebar toggle button to reflect visibility state.
458+
func setDiffSidebarButtonState(_ isOn: Bool) {
459+
diffSidebarButton?.state = isOn ? .on : .off
460+
}
461+
455462
// MARK: Surface Zoom
456463

457464
/// Set to true if a surface is currently zoomed to show the reset zoom button.

0 commit comments

Comments
 (0)