Sign In Sign Up

Update tab bar constraints in Tahoe view

We need to update @macos/Sources/Features/Terminal/Window Styles/TerminalTabsTitlebarTahoe.swift tab bar constraints to align the right edge of the tab bar with the left edge of the update accessory view so it remains visible.

Updated the tab bar constraints to align with the update accessory view. The code now finds any non-tab-bar accessory view with .right layout attribute and constrains the tab bar's right edge to its left edge.

Run `zig build` to verify.

Build successful! The tab bar constraints now align with the update accessory view's left edge.

*** Assertion failure in -[NSTitlebarAccessoryViewController _auxiliaryViewFrameChanged:], NSTitlebarAccessoryViewController.m:314 FAULT: NSInternalInconsistencyException: changing the view's origin is not allowed; { NSAssertFile = "NSTitlebarAccessoryViewController.m"; NSAssertLine = 314; } changing the view's origin is not allowed ( 0 CoreFoundation 0x000000018df74770 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x000000018da52418 objc_exception_throw + 88 2 Foundation 0x000000019009cddc _userInfoForFileAndLine + 0 3 AppKit 0x0000000193196f5c -[NSTitlebarAccessoryViewController _auxiliaryViewFrameChanged:] + 388 4 CoreFoundation 0x000000018df1a574 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148 5 CoreFoundation 0x000000018df830c4 ___CFXRegistrationPost_block_invoke + 92 6 CoreFoundation 0x000000018df83008 _CFXRegistrationPost + 436 7 CoreFoundation 0x000000018def908c _CFXNotificationPost + 740 8 AppKit 0x00000001923293b0 -[NSView _postFrameChangeNotification] + 240 9 AppKit 0x0000000192f6d4dc -[NSView setFrameOrigin:] + 616 10 AppKit 0x0000000192f6dea8 -[NSView setFrame:] + 268 11 AppKit 0x0000000192353e7c NSViewActuallyUpdateFrameFromLayoutEngine + 236 12 AppKit 0x00000001923345ec -[NSView layout] + 636 13 AppKit 0x000000019268b500 block_destroy_helper + 428 14 AppKit 0x0000000192734604 block_destroy_helper.133 + 56 15 AppKit 0x00000001925ea9f8 block_destroy_helper + 6012 16 AppKit 0x00000001925eb008 block_destroy_helper + 7564 17 AppKit 0x0000000192f87ba0 ___NSViewLayout_block_invoke + 624 18 AppKit 0x00000001923329b0 NSPerformVisuallyAtomicChange + 108 19 AppKit 0x00000001923340d4 _NSViewLayout + 96 20 AppKit 0x0000000192f76ff0 __36-[NSView _layoutSubtreeWithOldSize:]_block_invoke + 372 21 AppKit 0x00000001923329b0 NSPerformVisuallyAtomicChange + 108 22 AppKit 0x0000000192f76e70 -[NSView _layoutSubtreeWithOldSize:] + 100 23 AppKit 0x0000000192f77128 __36-[NSView _layoutSubtreeWithOldSize:]_block_invoke + 684 24 AppKit 0x00000001923329b0 NSPerformVisuallyAtomicChange + 108 25 AppKit 0x0000000192f76e70 -[NSView _layoutSubtreeWithOldSize:] + 100 26 AppKit 0x0000000192f77128 __36-[NSView _layoutSubtreeWithOldSize:]_block_invoke + 684 27 AppKit 0x00000001923329b0 NSPerformVisuallyAtomicChange + 108 28 AppKit 0x0000000192f76e70 -[NSView _layoutSubtreeWithOldSize:] + 100 29 AppKit 0x0000000192f77128 __36-[NSView _layoutSubtreeWithOldSize:]_block_invoke + 684 30 AppKit 0x00000001923329b0 NSPerformVisuallyAtomicChange + 108 31 AppKit 0x0000000192f76e70 -[NSView _layoutSubtreeWithOldSize:] + 100 32 AppKit 0x0000000192f77cf4 __56-[NSView _layoutSubtreeIfNeededAndAllowTemporaryEngine:]_block_invoke + 908 33 AppKit 0x00000001923329b0 NSPerformVisuallyAtomicChange + 108 34 AppKit 0x0000000192f7795c -[NSView _layoutSubtreeIfNeededAndAllowTemporaryEngine:] + 100 35 AppKit 0x00000001923329b0 NSPerformVisuallyAtomicChange + 108 36 AppKit 0x0000000192333cb0 -[NSView layoutSubtreeIfNeeded] + 96 37 AppKit 0x000000019330135c -[NSWindow(NSConstraintBasedLayoutInternal) _layoutViewTree] + 120 38 AppKit 0x0000000193301574 -[NSWindow(NSConstraintBasedLayoutInternal) layoutIfNeeded] + 240 39 AppKit 0x0000000192389080 -[NSWindow _setUpFirstResponderBeforeBecomingVisible] + 68 40 AppKit 0x0000000192fadf90 -[NSWindow _doWindowWillBeVisibleAsSheet:] + 108 41 AppKit 0x0000000192faeed0 -[NSWindow _reallyDoOrderWindowAboveOrBelow:] + 1068 42 AppKit 0x0000000192fafa8c -[NSWindow _reallyDoOrderWindow:] + 64 43 AppKit 0x0000000192faff74 -[NSWindow _doOrderWindow:] + 300 44 AppKit 0x0000000192fad760 -[NSWindow makeKeyAndOrderFront:] + 40 45 AppKit 0x0000000193335194 -[NSWindowController showWindow:] + 532 46 ghostty.debug.dylib 0x00000001061f7bd8 $s7Ghostty18TerminalControllerC6newTab_4from14withBaseConfigACSgA2AV3AppC_So8NSWindowCSgAH20SurfaceConfigurationVSgtFZyyScMYccfU_ + 896 47 ghostty.debug.dylib 0x00000001060bf270 $sIeg_IeyB_TR + 48 48 libdispatch.dylib 0x00000001009a45cc _dispatch_call_block_and_release + 32 49 libdispatch.dylib 0x00000001009c14dc _dispatch_client_callout + 16 50 libdispatch.dylib 0x00000001009e52f0 _dispatch_main_queue_drain.cold.5 + 900 51 libdispatch.dylib 0x00000001009b5fbc _dispatch_main_queue_drain + 180 52 libdispatch.dylib 0x00000001009b5ef8 _dispatch_main_queue_callback_4CF + 44 53 CoreFoundation 0x000000018df50098 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 54 CoreFoundation 0x000000018df228cc __CFRunLoopRun + 1944 55 CoreFoundation 0x000000018dfe0898 _CFRunLoopRunSpecificWithOptions + 532 56 HIToolbox 0x000000019a91f730 RunCurrentEventLoopInMode + 316 57 HIToolbox 0x000000019a9229d0 ReceiveNextEventCommon + 488 58 HIToolbox 0x000000019aaac1f4 _BlockUntilNextEventMatchingListInMode + 48 59 AppKit 0x00000001927fa25c _DPSBlockUntilNextEventMatchingListInMode + 236 60 AppKit 0x0000000192310edc _DPSNextEvent + 588 61 AppKit 0x0000000192d63958 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688 62 AppKit 0x0000000192d63664 -[NSApplication(NSEventRouting) nextEventMatchingMask:untilDate:inMode:dequeue:] + 72 63 AppKit 0x0000000192309720 -[NSApplication run] + 368 64 AppKit 0x00000001922f5694 NSApplicationMain + 880 65 ghostty.debug.dylib 0x00000001060d875c __debug_main_executable_dylib_entry_point + 1596 66 dyld 0x000000018dac5d54 start + 7184

Build successful! The tab bar now accounts for the width of all right-aligned accessory views (like the update notification) by using padding rather than direct constraints.

This doesn't dynamically update as the accessory view width changes.

You're right. We need to observe accessory view changes and update the constraint dynamically. Let me fix this:

Edited TitlebarTabsTahoeTerminalWindow.swift
+20
-6

Now let me add the helper functions:

Edited TitlebarTabsTahoeTerminalWindow.swift
+38

Build successful! The tab bar constraints now dynamically update when accessory view widths change. The implementation:

  1. Stores the right constraint so it can be updated
  2. Observes frame changes on all right-aligned accessory views
  3. Recalculates and updates the constraint when any accessory view size changes
  4. Cleans up observers when the tab bar is removed