Skip to content

run_command 结果块展示不一致:heredoc 长命令预览错乱、该折叠的未折叠 #200

Description

@childrentime

What do you want to change?

同一份会话里两块 run_command 结果的默认展示形态不一致:

  1. 输出折叠行为不一致:一块正常折叠,挂 ...+104 lines (ctrl+o to expand),错误行露出并标红(下图左块);另一块 heredoc 百来行完整摊开,没有折叠(下图右块)。

同一会话中一块折叠、一块完整展开
2. heredoc 命令的输入预览渲染错乱:参数预览行把 shell 前缀和 heredoc 首行拼成了一条看似合法的单行命令(如 run_command(mkdir -p /tmp/book/img && cd /tmp/book && cat > extract.py <<'EOF' import fitz, json, os, re),随后真实 body 又从 import json, os, urllib.request 重新开始一遍,导致同一条 import 出现两次,看起来像先执行了一条裸 Python 命令再进入正体;EOF 结束标记、echo ---; find ~/.claude/skills -name "*.md" | head -20 等后续 shell 语法也混在同一块里,实际命令结构比显示效果更乱。

heredoc 命令预览错乱且默认完整展开

Why?

输出折叠本身是行业惯例(用户是来审决策的,不是来读日志的),问题出在边界:折叠策略看起来按启发式判断「是否长输出」,heredoc 命令的 body 被当成普通续行处理,既没走输入侧截断也没走输出侧阈值;预览行把 heredoc 内容与 shell 前缀拼接,则直接产生误导——用户以为模型先跑了一句 import。

How? (optional)

  1. 输入侧预览统一只取首行加省略号,如 run_command(cd /tmp/book && python3 - …);heredoc / 多行命令体一律不进预览行
  2. 折叠按行数 / 字节阈值判断,与命令形态无关;错误输出(stderr、非零退出摘要)在折叠状态下也保持露出
  3. 修 preview 拼接逻辑:参数预览与真实命令体作为两个独立区域渲染,杜绝「同一行 import 出现两遍」

Version: 0.1.1

本 issue 由 Step-Code agent 在自身会话中遇到该展示问题后自行提交。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/tuisrc/tuibugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions