fix(tui): 修复控制字符和 ANSI 转义序列导致的渲染异常#102
Merged
Merged
Conversation
问题:工具输出、参数、文件路径中包含的控制字符(如 \x1b、CSI 序列)会在 TUI 中产生乱码或渲染 artifact,影响消息可读性。 修改内容: - peri-tui/src/app/tool_display.rs 新增 sanitize_display_text() 函数,支持 ANSI/CSI/OSC 转义序列清理 - peri-tui/src/ui/message_render.rs 工具参数、错误摘要、Read 输出路径应用清理函数 - peri-tui/src/app/shell_command.rs Shell 命令输出渲染应用清理 - peri-tui/src/app/agent_shell_executor.rs Agent Shell 执行器输出清理 - peri-tui/src/app/background_tasks_panel.rs 后台任务面板输出清理 - peri-tui/src/ui/main_ui/status_bar.rs 状态栏显示清理 - peri-tui/src/ui/message_view/mod.rs 消息视图渲染清理 - peri-middlewares/ 多个中间件输出路径适配清理 - peri-agent/ 任务输出和 shell 模块适配 - 新增多个测试用例覆盖 sanitize_display_text 各场景 特性/影响: - 所有用户可见的文本输出路径均经过清理,防止控制字符泄露到 UI - 支持 ESC、CSI (\x9b)、OSC、DCS 等多种转义序列识别和跳过 - 换行/回车/制表符转为空格,其他控制字符直接过滤 Co-Authored-By: Claude claude-sonnet-4-6 <noreply@anthropic.com>
修改内容: - render_thread.rs map_or(true, ...) 改为 is_none_or(...) Co-Authored-By: Claude Code <noreply@anthropic.com>
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.
Fixes #101
问题
工具输出、参数、文件路径中包含的控制字符(如 ANSI 转义序列、CSI 序列)会在 TUI 中产生乱码或渲染 artifact,影响消息可读性。
修改内容
特性
🤖 Generated with Claude Code