Skip to content

Conversation

@William-Laverty
Copy link

Summary

Fixes the status bar's Line/Col information not appearing until the first tab switch after opening a workspace.

Problem

The tabBarTabIdSubject is a PassthroughSubject, which only emits values to subscribers when its send() method is called AFTER the subscription is created. When a workspace first opens:

  1. StatusBarCursorPositionLabel.onAppear fires and calls updateSource()
  2. updateSource() reads editorManager.activeEditor.selectedTab (may be nil during loading)
  3. tabBarTabIdSubject.onReceive is subscribed but no initial value is emitted
  4. Status bar stays empty until user switches tabs

Solution

Modified switchToActiveEditor() to:

  1. Send the current selectedTab value immediately when setting up the subscription
  2. Use dropFirst() on the publisher to avoid duplicate emissions

This ensures all subscribers receive the initial tab state when the workspace loads.

Testing

  1. Close all CodeEdit windows
  2. Open a project that has files to display
  3. Verify Line/Col appears in status bar immediately without switching tabs
  4. Switch tabs and verify Line/Col continues to update correctly
  5. Open additional windows and verify they work correctly

Fixes #1729

…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 CodeEditApp#1729
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐞 Status Bar does not update when workspace is first opened

1 participant