Skip to content

Commit cb2fdb2

Browse files
LeonardoLarranagaLeonardo Larrañaga
andauthored
"Close Tabs to the Right" no longer closes the tab the action is performed on (#1901)
Fixes an issue where "Close Tabs to the Right" would also close the tab the action was perfomed on. Co-authored-by: Leonardo Larrañaga <leonardolarranaga@icloud.com>
1 parent f705595 commit cb2fdb2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

CodeEdit/Features/Editor/TabBar/Views/EditorTabBarContextMenu.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@ struct EditorTabBarContextMenu: ViewModifier {
5353
}
5454
}
5555
}
56+
5657
Button("Close Tabs to the Right") {
5758
withAnimation {
58-
if let index = tabs.tabs.firstIndex(where: { $0.file == item }) {
59-
tabs.tabs[index...].forEach {
59+
if let index = tabs.tabs.firstIndex(where: { $0.file == item }), index + 1 < tabs.tabs.count {
60+
tabs.tabs[(index + 1)...].forEach {
6061
tabs.closeTab(file: $0.file)
6162
}
6263
}

0 commit comments

Comments
 (0)