feat(terminal): 终端左边距显示行时间戳与行号 - #225
Merged
Merged
Conversation
- terminal: 新增 line_timeline 行时间轴,按网格绝对行号记录每行到达时间, 在 Wakeup 处采样,不接管输出路径,本地/SSH/Telnet/串口行为一致。 - terminal_view: 网格左侧留出边距列绘制时间戳与行号,网格列数、鼠标坐标、 IME 与补全浮层位置同步扣减;备用屏幕不展示。 - core/settings 与设置面板新增「显示每行时间戳」「显示行号」开关。
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.
需求
issue #220:终端支持时间戳展示,方便查看命令执行的时长;显示与否可配置。
方案
照 WindTerm 的做法,在应用侧的左侧边距列绘制「行时间戳 + 行号」,不改 shell、不接管输出路径:
[HH:MM:SS](10 格)+ 3 格 + 行号 + 3 格 + 内容;行号列宽跟随当前最大行号位数,不再为空量级预留空白。terminalcrate 新增line_timeline):以history_size + grid_line作为行的绝对 id,在TerminalEvent::Wakeup处采样,因此本地 / SSH / Telnet / 串口行为一致,后台 tab 也能继续记录;备用屏幕(vim/less 等)直接跳过。terminal_view)预留边距列:网格原点右移、网格列数扣减,鼠标坐标 / IME 候选框 / 历史补全浮层位置同步扣减。core/settings与终端设置面板新增「显示每行时间戳」「显示行号」两个开关。已知取舍
验证
cargo test -p terminal --lib→ 501 passedcargo test -p terminal_view --lib→ 547 passed(含新增的边距列数 / 行号列宽单测)cargo check -p terminal_view --all-targets通过,cargo clippy无新增告警,rustfmt --check干净Closes #220