🟡 [M14] ensure_viewport_cache 使用过时的 v_offset 局部变量 #24
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
文件:
tui/app.rs:241-268分类: 滚动 / 状态一致性
问题:
ensure_viewport_cache在参数变化块之前捕获v_offset,变化块可能修改self.v_offset,但 loading 分支仍使用旧的局部变量。建议修复: 在参数变化块之后重新读取
self.v_offset。已修复,提交:
70f930e根因: ensure_viewport_cache 在 params_changed 块之前捕获 v_offset 局部变量,而该块会重新计算 self.v_offset(cursor 居中 + clamp)。loading 分支仍使用旧值导致视口错位。
修复: 删除过时的局部变量,loading 分支直接读取 self.v_offset,与非 loading 分支保持一致。
回归测试: test_loading_viewport_cache_uses_updated_v_offset_on_params_changed