From 553687b5e2c0e48ca6208e0bf7f4a91717837d1c Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 23 Oct 2024 20:12:58 +0200 Subject: [PATCH] feat: make too big tab indices go to last tab --- macos/Sources/Features/Terminal/TerminalController.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index 0b1ff3b72..a015d88d6 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -211,7 +211,7 @@ class TerminalController: BaseTerminalController { window.restorationClass = TerminalWindowRestoration.self window.identifier = .init(String(describing: TerminalWindowRestoration.self)) } - + // If window decorations are disabled, remove our title if (!ghostty.config.windowDecorations) { window.styleMask.remove(.titled) } @@ -518,7 +518,10 @@ class TerminalController: BaseTerminalController { finalIndex = Int(tabIndex - 1) } - guard finalIndex >= 0 && finalIndex < tabbedWindows.count else { return } + guard finalIndex >= 0 else { return } + if finalIndex >= tabbedWindows.count { + finalIndex = tabbedWindows.count - 1 + } let targetWindow = tabbedWindows[finalIndex] targetWindow.makeKeyAndOrderFront(nil) }