Skip to content

fix(#965): 修复编辑器高频输入时光标跳动问题#971

Merged
codexu merged 1 commit intodevfrom
fix/editor-cursor-jump
Mar 9, 2026
Merged

fix(#965): 修复编辑器高频输入时光标跳动问题#971
codexu merged 1 commit intodevfrom
fix/editor-cursor-jump

Conversation

@codexu
Copy link
Copy Markdown
Owner

@codexu codexu commented Mar 9, 2026

No description provided.

问题原因:
- 每次本地保存后都会触发 setContent 调用
- 即使内容没有变化,useEffect 仍可能执行
- 高频输入时导致光标位置被重置

修复方案:
- 移除监听 initialContent 变化的 useEffect
- 添加专门事件 editor-content-from-remote 处理远程拉取
- 使用 justPulledFile 标志区分远程拉取和本地保存
- 只有远程拉取时才触发 setContent

Co-Authored-By: Claude Opus 4.6 <[email protected]>
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.

1 participant