🟡 [M14] ensure_viewport_cache 使用过时的 v_offset 局部变量 #24

Closed
opened 2026-06-03 13:53:57 +08:00 by dailz · 1 comment
Owner

文件: tui/app.rs:241-268
分类: 滚动 / 状态一致性

问题: ensure_viewport_cache 在参数变化块之前捕获 v_offset,变化块可能修改 self.v_offset,但 loading 分支仍使用旧的局部变量。

建议修复: 在参数变化块之后重新读取 self.v_offset

**文件**: `tui/app.rs:241-268` **分类**: 滚动 / 状态一致性 **问题**: `ensure_viewport_cache` 在参数变化块之前捕获 `v_offset`,变化块可能修改 `self.v_offset`,但 loading 分支仍使用旧的局部变量。 **建议修复**: 在参数变化块之后重新读取 `self.v_offset`。
dailz added the bugseverity/mediumarea/tui labels 2026-06-03 13:53:57 +08:00
Author
Owner

已修复,提交: 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

已修复,提交: 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
dailz closed this issue 2026-06-11 08:58:37 +08:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dailz/logViewer#24