Skip to content

Fix #1729: Status bar cursor updates without requiring a tab switch - #2188

Open
Borisserz wants to merge 1 commit into
CodeEditApp:mainfrom
Borisserz:fix/1729-statusbar-cursor-initial
Open

Fix #1729: Status bar cursor updates without requiring a tab switch#2188
Borisserz wants to merge 1 commit into
CodeEditApp:mainfrom
Borisserz:fix/1729-statusbar-cursor-initial

Conversation

@Borisserz

Copy link
Copy Markdown

Description

Fixes the status bar Line/Col label staying empty (or stale) until the first editor tab switch after opening a workspace.

Root causes addressed:

  • Editor.openTab could select a freshly allocated EditorInstance while tabs kept a different object for the same file (EditorInstance equality is by file). The editor view and status bar then observed different publishers.
  • CodeFileView wrote newState.cursorPositions ?? [], clearing the caret on scroll-only SourceEditor updates that omit cursor state.
  • The status bar label now tracks the active instance by object identity, seeds from the current caret, and falls back safely when line/column are unresolved.

Also documents the behavior in DocC and adds unit + UI regression coverage.

Related Issues

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Screenshots

N/A for this logic fix (status bar text). UI regression covered in ProjectNavigatorUITests.

Test plan

  • StatusBarCursorPositionLabelTests (label formatting / unresolved fallback)
  • EditorTabReuseTests (reopen reuses same EditorInstance)
  • SwiftLint --strict on touched files (0 violations)
  • Manual: open workspace from Welcome → Line/Col visible without switching tabs; clicking in editor updates the label
  • CI SwiftLint + tests green

Made with Cursor

Reuse the EditorInstance stored in tabs, avoid clearing caret on nil SourceEditor updates, and bind the status bar label by object identity so Line/Col appears without a tab switch.
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