🐞 Programmatic cursor state updates are never applied
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
Research direction
Start at SourceEditor.updateControllerWithState(_:controller:) and inspect how state.cursorPositions is compared with the controller's current cursor positions. Reproduce the binding update described in the issue, then verify that assigning a different SourceEditorState.cursorPositions value moves the underlying TextViewController cursor.
Written by the indexing model from the issue text.
Description
Description
Programmatic updates to SourceEditorState.cursorPositions are never applied to the underlying TextViewController.
In SourceEditor.updateControllerWithState(_:controller:), the new cursor positions are compared with the same state value:
if let cursorPositions = state.cursorPositions, cursorPositions != state.cursorPositions {
controller.setCursorPositions(cursorPositions)
}
Because cursorPositions was just unwrapped from state.cursorPositions, the comparison is always false.
To Reproduce
- Create a
SourceEditorwith a binding toSourceEditorState. - After the editor appears, programmatically assign a different value to
state.cursorPositions. - Observe that the editor cursor does not move to the requested position.
Expected Behavior
Changing SourceEditorState.cursorPositions should update the cursor positions in the underlying controller.
The comparison likely needs to use the controller's current state:
if let cursorPositions = state.cursorPositions,
cursorPositions != controller.cursorPositions {
controller.setCursorPositions(cursorPositions)
}
Version Information
CodeEditSourceEditor: main, revision 1fa4d3c
macOS: 15.7.9
Xcode: 26.3 (17C529)
Additional Context
No matching open or closed issue was found before filing this report.
Screenshots
Not applicable.
- Dominant language
- Swift
- Stars
- 720
- Forks
- 162
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CodeEditApp/CodeEditSourceEditor
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
CodeEditApp/CodeEditSourceEditor#376 · 1 comment ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
CodeEditApp/CodeEditSourceEditor#378 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 32/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
All issues in CodeEditApp/CodeEditSourceEditor
Similar issues
-
type: docs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
googleapis/google-cloud-swift#971 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mozilla-mobile/firefox-ios#35743 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
manaflow-ai/cmux#13417 ·
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ionic-team/capacitor#8616 ·