From b6ac6e1d479f29fb8194f86ec24b72901aa94c21 Mon Sep 17 00:00:00 2001 From: Lukas <134181853+bo2themax@users.noreply.github.com> Date: Wed, 26 Aug 2026 22:44:12 +0200 Subject: [PATCH] Revert "macOS: use same ResetZoomAccessoryView (#14028)" This reverts commit 15ff186f65ca0bdbd1fa397ab03908d59de16463, reversing changes made to 1abd53ee537a93bb33107a415fe4f4131bcf0f5b. --- .../Window Styles/TerminalWindow.swift | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/macos/Sources/Features/Terminal/Window Styles/TerminalWindow.swift b/macos/Sources/Features/Terminal/Window Styles/TerminalWindow.swift index 695bd16d4..ac1d2b881 100644 --- a/macos/Sources/Features/Terminal/Window Styles/TerminalWindow.swift +++ b/macos/Sources/Features/Terminal/Window Styles/TerminalWindow.swift @@ -136,7 +136,6 @@ class TerminalWindow: NSWindow { resetZoomAccessory.layoutAttribute = .right resetZoomAccessory.view = NSHostingView(rootView: ResetZoomAccessoryView( viewModel: viewModel, - isInToolbar: true, action: { [weak self] in guard let self else { return } self.terminalController?.splitZoom(self) @@ -198,8 +197,14 @@ class TerminalWindow: NSWindow { super.close() } + override func becomeKey() { + super.becomeKey() + resetZoomTabButton.contentTintColor = .controlAccentColor + } + override func resignKey() { super.resignKey() + resetZoomTabButton.contentTintColor = .secondaryLabelColor tabTitleEditor.finishEditing(commit: true) } @@ -364,16 +369,19 @@ class TerminalWindow: NSWindow { } } - private lazy var resetZoomTabButton: NSView = generateResetZoomButton() + private lazy var resetZoomTabButton: NSButton = generateResetZoomButton() - private func generateResetZoomButton() -> NSView { - let button = NSHostingView(rootView: ResetZoomAccessoryView( - viewModel: viewModel, - isInToolbar: false, - action: { [weak self] in - guard let self else { return } - self.terminalController?.splitZoom(self) - })) + private func generateResetZoomButton() -> NSButton { + let button = NSButton() + button.isHidden = true + button.target = terminalController + button.action = #selector(TerminalController.splitZoom(_:)) + button.isBordered = false + button.allowsExpansionToolTips = true + button.toolTip = "Reset Zoom" + button.contentTintColor = isMainWindow ? .controlAccentColor : .secondaryLabelColor + button.state = .on + button.image = NSImage(named: "ResetZoom") button.frame = NSRect(x: 0, y: 0, width: 20, height: 20) button.translatesAutoresizingMaskIntoConstraints = false button.widthAnchor.constraint(equalToConstant: 20).isActive = true @@ -633,36 +641,27 @@ extension TerminalWindow { struct ResetZoomAccessoryView: View { @ObservedObject var viewModel: ViewModel - let isInToolbar: Bool let action: () -> Void var body: some View { if viewModel.isSurfaceZoomed { - if isInToolbar { - VStack { - button - Spacer() + VStack { + Button(action: action) { + Image("ResetZoom") + .foregroundColor(viewModel.isMainWindow ? .accentColor : .secondary) } - // With a toolbar, the window title is taller, so we need more padding - // to properly align. - .padding(.top, viewModel.accessoryTopPadding) - // We always need space at the end of the titlebar - .padding(.trailing, 10) - } else { - button + .buttonStyle(.plain) + .help("Reset Split Zoom") + .frame(width: 20, height: 20) + Spacer() } + // With a toolbar, the window title is taller, so we need more padding + // to properly align. + .padding(.top, viewModel.accessoryTopPadding) + // We always need space at the end of the titlebar + .padding(.trailing, 10) } } - - var button: some View { - Button(action: action) { - Image("ResetZoom") - .foregroundColor(viewModel.isMainWindow ? .accentColor : .secondary) - } - .buttonStyle(.plain) - .help("Reset Split Zoom") - .frame(width: 20, height: 20) - } } /// A pill-shaped button that displays update status and provides access to update actions. @@ -677,6 +676,7 @@ extension TerminalWindow { .padding(.trailing, viewModel.accessoryTopPadding) } } + } /// A small circle indicator displayed in the tab accessory view that shows