Skip to content

Commit f2c3278

Browse files
Fix status bar not updating when workspace is first opened
The status bar cursor position label relied solely on tabBarTabIdSubject (a PassthroughSubject) and onAppear to get the current tab. When a workspace was first opened, the selected tab was set during state restoration before the status bar view subscribed to the subject, causing it to miss the initial value. This adds an additional onReceive subscriber to the active editor's $selectedTab publisher, which is a @published property and replays its current value on subscription, ensuring the status bar updates immediately. Fixes #1729
1 parent 07aaee2 commit f2c3278

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

CodeEdit/Features/StatusBar/Views/StatusBarItems/StatusBarCursorPositionLabel.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ struct StatusBarCursorPositionLabel: View {
3838
.onReceive(editorManager.tabBarTabIdSubject) { _ in
3939
updateSource()
4040
}
41+
.onReceive(editorManager.activeEditor.$selectedTab) { _ in
42+
updateSource()
43+
}
4144
}
4245

4346
struct LineLabel: View {

0 commit comments

Comments
 (0)