Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CodeEdit/Features/Editor/Models/EditorManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ class EditorManager: ObservableObject {
func switchToActiveEditor() {
cancellable?.cancel()
cancellable = nil

// Send the current value immediately so subscribers get the initial state
tabBarTabIdSubject.send(activeEditor.selectedTab)

cancellable = activeEditor.$selectedTab
.dropFirst() // Avoid duplicate emission since we just sent the current value
.sink { [weak self] tab in
self?.tabBarTabIdSubject.send(tab)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ extension ProjectNavigatorMenu {
if let newFile = try workspace?.workspaceFileManager?.addFile(fileName: "untitled", toFile: item) {
workspace?.listenerModel.highlightedFileItem = newFile
workspace?.editorManager?.openTab(item: newFile)
renameFile()
}
} catch {
let alert = NSAlert(error: error)
Expand Down Expand Up @@ -147,6 +148,7 @@ extension ProjectNavigatorMenu {
do {
if let newFolder = try workspace?.workspaceFileManager?.addFolder(folderName: "untitled", toFile: item) {
workspace?.listenerModel.highlightedFileItem = newFolder
renameFile()
}
} catch {
let alert = NSAlert(error: error)
Expand Down