macos: use switch statement instead of if-let

This commit is contained in:
Thorsten Ball
2024-01-13 08:32:50 +01:00
parent 90427a8d22
commit 2bf8dac864

View File

@ -129,12 +129,18 @@ class TerminalManager {
// the macOS APIs only work on a visible window.
controller.showWindow(self)
// Add the window to the tab group and show it. If we already have a tab group
// and we want the new tab to open at the end, then we use the last window in
// the tab group as the parent.
if let last = parent.tabGroup?.windows.last, ghostty.windowNewTabPosition == "end" {
last.addTabbedWindow(window, ordered: .above)
} else {
// Add the window to the tab group and show it.
switch ghostty.windowNewTabPosition {
case "end":
// If we already have a tab group and we want the new tab to open at the end,
// then we use the last window in the tab group as the parent.
if let last = parent.tabGroup?.windows.last {
last.addTabbedWindow(window, ordered: .above)
} else {
fallthrough
}
case "current": fallthrough
default:
parent.addTabbedWindow(window, ordered: .above)
}