From 8c0535539e747f4ed9d5bd639582f93b1e80f111 Mon Sep 17 00:00:00 2001 From: William Laverty Date: Wed, 4 Feb 2026 01:07:55 -0800 Subject: [PATCH] Fix: Status bar not updating when workspace first opens (#1729) The status bar's Line/Col information wasn't appearing until the first tab switch because tabBarTabIdSubject (a PassthroughSubject) only emitted values when selectedTab CHANGED, not its initial value. Fixed by: 1. Sending the current selectedTab value immediately in switchToActiveEditor() 2. Using dropFirst() on the publisher subscription to avoid duplicate emissions This ensures subscribers like StatusBarCursorPositionLabel receive the initial tab state when the workspace loads. Fixes #1729 --- CodeEdit/Features/Editor/Models/EditorManager.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CodeEdit/Features/Editor/Models/EditorManager.swift b/CodeEdit/Features/Editor/Models/EditorManager.swift index 4e8eae3493..72b5441d2f 100644 --- a/CodeEdit/Features/Editor/Models/EditorManager.swift +++ b/CodeEdit/Features/Editor/Models/EditorManager.swift @@ -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) }