fix: check if tab is part of the fullscreen group

pull/10253/head
Eric bower 2026-01-20 13:56:07 -05:00
parent dd4b966b70
commit 768e94defe
No known key found for this signature in database
1 changed files with 13 additions and 10 deletions

View File

@ -512,20 +512,23 @@ class BaseTerminalController: NSWindowController,
// For fullscreen windows with tabs, force a relayout on all tabs.
// After a monitor disconnect, the window frames become stale. Cycling
// through tabs fixes this, so we simulate that by ordering each window.
// through tabs fixes this, so we simulate that by changing the selected tab.
if window.styleMask.contains(.fullScreen) {
if let tabGroup = window.tabGroup, tabGroup.windows.count > 1 {
DispatchQueue.main.async {
// Remember the current main window
let currentMain = window
// Briefly make each background tab key to trigger layout recalculation
for tabWindow in tabGroup.windows where tabWindow != currentMain {
tabWindow.makeKeyAndOrderFront(nil)
// Remember the current selected window
let originalSelected = tabGroup.selectedWindow
// Briefly select each tab to trigger layout recalculation
// Only cycle through tabs that have the fullscreen style mask
for tabWindow in tabGroup.windows where tabWindow != originalSelected && tabWindow.styleMask.contains(.fullScreen) {
tabGroup.selectedWindow = tabWindow
}
// Restore the original selection
if let originalSelected {
tabGroup.selectedWindow = originalSelected
}
// Restore the original window as key
currentMain.makeKeyAndOrderFront(nil)
}
}
return