Repository navigation
[6032] 修复渐进式排版跳转至文末后在末尾按回车导致文档排版与光标混乱 - #4785
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题描述
长文档(如
6242.stem)在大纲侧边栏跳转至文末并下移光标至最后一行后,按下回车键会导致:start,撤销回车后视口直接跳回第 1 页。根因分析
max_typeset_child == n_old。文末回车触发bridge_document_rep::notify_insert(n = n_old + 1)并调用progressive_reset(),但max_typeset_child未同步递增,导致下一轮typesetter_rep::typeset()计算chunk_end = min(n, max_typeset_child) = n_old < n,将新插入且光标所在的末尾节点遗漏在首轮分块之外,落入progressive_pending = true。typesetter.cpp中先因if (env->complete)清空了env->local_aux,随后才因chunk_end < n将env->complete设为false,导致辅助引用表被清空却跳过determine_page_references,引发分页与光标混乱。修复内容
src/Typeset/Bridge/bridge_document.cpp:顶层根文档notify_insert/notify_remove时同步更新max_typeset_child,确保文末插入节点在首轮重排即被覆盖;src/Typeset/Bridge/typesetter.cpp:调整progressive_enabled && chunk_end < n修正env->complete = false的时序至清空local_aux之前;tests/Typeset/progressive_typeset_test.cpp:新增test_append_at_end_after_full_typeset回归单元测试。验证结果
xmake b progressive_typeset_test && xmake r progressive_typeset_test:7 passed, 0 failed;python3 ~/git/dev-agent/tests/mogan/python/6242.py --verify:端到端真机验收通过。