Skip to content

Commit

Permalink
New tabs after current focus Bug Fix for issue #1704 (#1719)
Browse files Browse the repository at this point in the history
* Update Editor.swift

changed tab append to tab insert at index after selected tab

* Update Editor.swift

Fixed issue where tab deleted tab next to it.

* Update Editor.swift

Fixed issue where closing a file on the side window caused an error.
  • Loading branch information
Shivam-Parekh committed May 16, 2024
1 parent 5489999 commit 60e4b4f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions CodeEdit/Features/Editor/Models/Editor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,11 @@ final class Editor: ObservableObject, Identifiable {
if let index {
tabs.insert(item, at: index)
} else {
guard let currentTab = selectedTab, let currentIndex = tabs.firstIndex(of: currentTab)
else {
if let selectedTab, let currentIndex = tabs.firstIndex(of: selectedTab) {
tabs.insert(item, at: tabs.index(after: currentIndex))
} else {
tabs.append(item)
return
}
let nextIndex = tabs.index(after: currentIndex)
tabs.insert(item, at: nextIndex)
}
selectedTab = item
if !fromHistory {
Expand Down

0 comments on commit 60e4b4f

Please sign in to comment.