We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7690484 commit 7fabba7Copy full SHA for 7fabba7
1 file changed
TablePro/Views/Main/Extensions/MainContentCoordinator+SaveChanges.swift
@@ -234,9 +234,12 @@ extension MainContentCoordinator {
234
)
235
236
if !tabIdsToRemove.isEmpty {
237
+ let firstRemovedIndex = tabManager.tabs
238
+ .firstIndex { tabIdsToRemove.contains($0.id) } ?? 0
239
tabManager.tabs.removeAll { tabIdsToRemove.contains($0.id) }
- if let firstRemaining = tabManager.tabs.first {
- tabManager.selectedTabId = firstRemaining.id
240
+ if !tabManager.tabs.isEmpty {
241
+ let neighborIndex = min(firstRemovedIndex, tabManager.tabs.count - 1)
242
+ tabManager.selectedTabId = tabManager.tabs[neighborIndex].id
243
} else {
244
tabManager.selectedTabId = nil
245
}
0 commit comments