Skip to content

Fix status bar cursor updates when opening files#2177

Open
jkaunert wants to merge 2 commits into
CodeEditApp:mainfrom
jkaunert:fix/issue-1729-statusbar-initial-update
Open

Fix status bar cursor updates when opening files#2177
jkaunert wants to merge 2 commits into
CodeEditApp:mainfrom
jkaunert:fix/issue-1729-statusbar-initial-update

Conversation

@jkaunert

@jkaunert jkaunert commented Jun 12, 2026

Copy link
Copy Markdown

Description

Fixes the status bar cursor-position label when files are opened from the project navigator, including the first file after workspace launch and subsequent tabs opened in the same workspace.

The label could show unresolved cursor positions such as Line: -1 Col: -1, or fail to refresh after opening another tab, because the status bar could read cursor state before the source editor had resolved range-based cursor positions to line/column values.

This change:

  • preserves the default cursor position when the source editor has not emitted cursor state yet
  • avoids replacing missing source-editor cursor state with an empty cursor array
  • resolves range-based cursor positions through the existing editor range translator
  • refreshes the cursor label when the active editor, selected tab, or editor controller lifecycle changes
  • recreates the line label when the selected editor instance changes
  • adds a focused UI regression test that opens README.md, opens LICENSE.md, verifies resolved line/column text, and clicks in the editor to confirm the label updates

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

Demo video attached in the PR conversation.

@jkaunert

jkaunert commented Jun 12, 2026

Copy link
Copy Markdown
Author
codeedit-1729-ui-test-window-recording.mov

@jkaunert jkaunert force-pushed the fix/issue-1729-statusbar-initial-update branch 3 times, most recently from 3603dc8 to ee3d3cf Compare June 12, 2026 04:34
@jkaunert jkaunert force-pushed the fix/issue-1729-statusbar-initial-update branch from ee3d3cf to bb6aed3 Compare June 12, 2026 04:42
@jkaunert jkaunert changed the title Fix initial status bar cursor position Fix status bar cursor updates when opening files Jun 12, 2026
@jkaunert jkaunert marked this pull request as ready for review June 12, 2026 05:14
Copilot AI review requested due to automatic review settings June 12, 2026 05:14
@jkaunert

Copy link
Copy Markdown
Author

Ready for review.

Local validation:

  • Focused SwiftLint passed on the changed files.
  • Targeted UI regression test passed locally via XcodeBuildMCP.
  • Demo video attached above.

GitHub Actions is currently awaiting maintainer approval for the fork workflow. Could a maintainer assign #1729 and approve CI when convenient?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR improves the status bar’s cursor position reporting by resolving cursor positions via the editor’s range translator, and adds UI coverage to ensure the cursor position label is present and updates when interacting with editors/tabs.

Changes:

  • Added UI assertions for the cursor position label and cursor movement updates.
  • Updated status bar cursor label to refresh on editor/tab lifecycle events and to resolve cursor positions.
  • Adjusted editor state restoration/defaulting behavior for cursor positions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
CodeEditUITests/Features/NavigatorArea/ProjectNavigator/ProjectNavigatorUITests.swift Adds UI test coverage for cursor position label presence/resolution and updates on editor interaction.
CodeEdit/Features/StatusBar/Views/StatusBarItems/StatusBarCursorPositionLabel.swift Updates label refresh triggers and resolves cursor positions via the range translator; adds fallback label formatting.
CodeEdit/Features/Editor/Views/CodeFileView.swift Changes how cursor positions are applied from editor view state (ignores nil instead of forcing empty).
CodeEdit/Features/Editor/Models/EditorInstance.swift Refines cursor position initialization/defaulting and adds range translator events + cursor position resolving helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CodeEdit/Features/Editor/Views/CodeFileView.swift
@austincondiff

Copy link
Copy Markdown
Collaborator

Thanks for talking a look at this! Please be patient while we review and test your work.

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

3 participants