feat: make too big tab indices go to last tab

This commit is contained in:
Max
2024-10-23 20:12:58 +02:00
parent 61aff898bd
commit 553687b5e2

View File

@ -518,7 +518,10 @@ class TerminalController: BaseTerminalController {
finalIndex = Int(tabIndex - 1) 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] let targetWindow = tabbedWindows[finalIndex]
targetWindow.makeKeyAndOrderFront(nil) targetWindow.makeKeyAndOrderFront(nil)
} }