Repository navigation
[6017] 解决长文档目录跳转至尾部章节视口空白无法渲染的问题 - #4707
Merged
Merged
Conversation
Co-Authored-By: Claude <[email protected]>
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.
任务简述
在超长篇文档(如《凡人修仙传》第一卷
vol01.stem,99章、1001页)中,通过左侧大纲目录跳转至远端章节(如第99章)后,主视口呈现 100% 纯白死区,正文与标题内容完全无法绘制。原因分析与修复方案
重绘时环境变更未刷新导致拒绝绘制:
大纲跳转通过
tree-go-to改变光标位置标记了THE_CURSOR变更。在视口滚动触发 Qt 重绘时,handle_repaint检测到env_change != 0,原逻辑仅在is_nil(eb)时调用apply_changes(),导致抛出Invalid situation (1) in edit_interface_rep::handle_repaint并提前返回未绘制任何内容。在handle_repaint中增加if (is_nil (eb) || env_change != 0) apply_changes();,确保重绘前将待处理的变更刷新完毕。多倍缩放/高分屏坐标换算整型溢出:
超长文档中(千页规模),原点
oy在高分屏(Retina)及多倍缩放下已达到数亿量级。renderer_rep::set_zoom_factor原逻辑采用两步换算:先oy = (SI) tm_round (oy * zoomf)换算至绝对坐标,再oy = (SI) tm_round (oy / new_zoom)。第一步乘法产生中间值超过INT_MAX(2.147B) 导致 32 位有符号整型溢出为负数,使画布可见性检测ren->is_visible(...)判定全页面处于视口之外,eb->redraw绘制 0 个节点。将其优化为直接乘系数factor = zoomf / zoom避免中间整型溢出。验证
运行
python tests/mogan/python/6017.py端到端自动化测试,第99章成功正常渲染,中央视口异常纯白像素占比由 100.0% 降至 7.53%(通过判定阈值 < 15.0%)。