🐞 Programmatic cursor state updates are never applied
還沒有人認領這個 Issue。
評估
研究方向
從 SourceEditor.updateControllerWithState(_:controller:) 開始,檢查 state.cursorPositions 如何與 controller 目前的游標位置進行比較。重現 issue 中描述的 binding 更新,然後驗證為 SourceEditorState.cursorPositions 指派不同的值會移動底層 TextViewController 的游標。
由索引模型根據 Issue 內容生成。
描述
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.
- 主要語言
- Swift
- 星號
- 720
- 分支
- 162
- PR 合併指標
- 30 天內沒有已合併 PR
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
CodeEditApp/CodeEditSourceEditor 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
CodeEditApp/CodeEditSourceEditor#376 · 1 則留言 ·
-
難度 1/5 1-3 小時 新手友好度 68/100
-
難度 3/5 1-2 天 新手友好度 68/100
CodeEditApp/CodeEditSourceEditor#378 · 1 則留言 ·
-
難度 4/5 3-5 天 新手友好度 32/100
-
bug
難度 3/5 1-2 天 新手友好度 45/100
查看 CodeEditApp/CodeEditSourceEditor 的全部 Issue
相似的 Issue
-
enhancement
難度 2/5 1-3 小時 新手友好度 68/100
-
type: docs
難度 1/5 1 小時以內 新手友好度 95/100
googleapis/google-cloud-swift#971 ·
-
難度 2/5 1-3 小時 新手友好度 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
難度 2/5 1-3 小時 新手友好度 72/100
mozilla-mobile/firefox-ios#35743 ·
-
難度 2/5 1-3 小時 新手友好度 84/100
manaflow-ai/cmux#13417 ·