Skip to content

Table inline-code highlight is lost after wrapping in narrow markdown tables #4052

@chiga0

Description

@chiga0

What happened?

When a markdown table cell contains a long inline-code value, such as a table name wrapped in backticks, the first visual line is rendered with the inline-code foreground color, but the continuation line loses that syntax highlight after the terminal is narrowed enough to wrap the cell.

This is visible in table output from the interactive TUI. The table name remains readable, but the continuation segment is emitted without the active code foreground color.

Reproduction evidence from origin/main:

  • Terminal-capture E2E harness: integration-tests/terminal-capture/table-inline-code-wrap-regression.ts
  • Terminal size: 100x32
  • Scenario: a local fake OpenAI-compatible server returns a fixed markdown table containing a long inline-code table name.
  • Base summary: finalScreenWrappedTableName: true, coloredContinuationOccurrences: 0, uncoloredContinuationOccurrences: 1, pass: false.
  • Base screenshot:

Base E2E screenshot

中文说明:当 markdown 表格单元格里包含很长的 inline code(例如反引号包裹的表名)时,窄屏触发表格单元格换行后,第一行表名有代码高亮,但续行丢失了高亮。表名内容还在,但续行输出时没有 active code foreground color。

What did you expect to happen?

All wrapped visual lines that are still inside the same inline-code span should keep the inline-code foreground color. The table renderer should not require special table-name detection; any ANSI foreground color active at a wrap boundary should be preserved across the inserted newline until an explicit foreground reset or full reset is encountered.

Expected metric for the same E2E scenario after the fix:

  • finalScreenWrappedTableName: true
  • coloredContinuationOccurrences: 1
  • uncoloredContinuationOccurrences: 0
  • pass: true

Fixed-branch screenshot from PR #4050:

Fixed E2E screenshot

中文说明:同一个 inline-code span 在表格内换行后,续行仍应保持代码前景色。修复不应该特殊识别表名,而应该在表格 ANSI 字符串换行链路里延续 active foreground,直到遇到 390 重置。

Client information

Client Information

Observed and reproduced with local development builds of Qwen Code on macOS.

Reproduction setup:

Repository: QwenLM/qwen-code
Base: origin/main
CLI: node dist/cli.js
Terminal: terminal-capture, 100 columns x 32 rows
Auth path: OpenAI-compatible configuration pointed at a local fake server
Model: dummy

The E2E test uses a deterministic local fake OpenAI /v1/chat/completions server, so the reproduction does not depend on a real model response.

中文说明:该问题通过本地开发构建在 macOS 上复现。E2E 使用本地 fake OpenAI server 固定返回 markdown 表格,不依赖真实模型随机输出。

Login information

OpenAI-compatible auth path with a dummy API key and a local fake OpenAI server:

--auth-type openai --openai-api-key dummy --openai-base-url http://127.0.0.1:<port>/v1 --model dummy

中文说明:复现使用 OpenAI-compatible 登录路径,base URL 指向本地 fake server。

Anything else we need to know?

A proposed fix is available in PR #4050: #4050

Uploaded E2E artifacts:

中文说明:PR #4050 已包含修复、单测和 E2E 回归测试。E2E 产物已上传到 fork 的 artifact commit,reviewer 可以直接访问截图和 summary。

Metadata

Metadata

Assignees

Labels

category/uiUser interface and displayscope/markdownMarkdown parsing and displayscope/renderingDisplay and rendering logicstatus/needs-triageIssue needs to be triaged and labeledtype/bugSomething isn't working as expected

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions