-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix(cli): preserve table ANSI color across wrapped lines #4050
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # Table Inline-Code Wrap ANSI Highlight E2E | ||
|
|
||
| ## Problem | ||
|
|
||
| Markdown tables render inline code as ANSI-colored strings before wrapping cell | ||
| content. In narrow terminals, `wrap-ansi` can split a truecolor inline-code span | ||
| without re-opening its foreground color on the continuation line, so long table | ||
| names lose their code highlight after wrapping. | ||
|
|
||
| ## Scenario | ||
|
|
||
| - Script: | ||
| `integration-tests/terminal-capture/table-inline-code-wrap-regression.ts` | ||
| - Trigger: a fake OpenAI server returns a fixed markdown table containing a long | ||
| inline-code table name. | ||
| - Terminal: `100x32`, real `node dist/cli.js`, OpenAI-compatible auth pointed at | ||
| the local fake server. | ||
| - Metric: every raw ANSI occurrence of the wrapped table-name suffix | ||
| `244650615` must have an active `38;2` foreground color, and the final screen | ||
| must contain the suffix without containing the full table name on one line. | ||
|
|
||
| ## Commands | ||
|
|
||
| ```bash | ||
| cd /Users/gawain/Documents/codebase/opensource/qwen-code-table-wrap-ansi-highlight | ||
|
|
||
| cd packages/cli && npx vitest run src/ui/utils/TableRenderer.test.tsx | ||
|
|
||
| cd /Users/gawain/Documents/codebase/opensource/qwen-code-table-wrap-ansi-highlight | ||
| npm run build && npm run typecheck && npm run bundle | ||
|
|
||
| QWEN_TUI_E2E_OUT=/tmp/qwen-table-wrap-ansi/fixed \ | ||
| npx tsx integration-tests/terminal-capture/table-inline-code-wrap-regression.ts | ||
|
|
||
| QWEN_TUI_E2E_REPO=/Users/gawain/Documents/codebase/opensource/qwen-code-table-wrap-ansi-highlight-base \ | ||
| QWEN_TUI_E2E_OUT=/tmp/qwen-table-wrap-ansi/base \ | ||
| QWEN_TUI_E2E_EXPECT_PASS=false \ | ||
| npx tsx integration-tests/terminal-capture/table-inline-code-wrap-regression.ts | ||
| ``` | ||
|
|
||
| ## Results | ||
|
|
||
| | Branch | Expected | wrapped | continuationOccurrences | colored | uncolored | Result | | ||
| | --- | --- | --- | ---: | ---: | ---: | --- | | ||
| | `origin/main` base worktree | failure-first reproduction | true | 1 | 0 | 1 | reproduced | | ||
| | `fix/table-wrap-ansi-highlight` | strict pass | true | 1 | 1 | 0 | passed | | ||
|
|
||
| ## Artifacts | ||
|
|
||
| - Base summary: `/tmp/qwen-table-wrap-ansi/base/summary.json` | ||
| - Base raw ANSI: `/tmp/qwen-table-wrap-ansi/base/raw.ansi.log` | ||
| - Base screenshot: `/tmp/qwen-table-wrap-ansi/base/table-inline-code-wrap.png` | ||
| - Fixed summary: `/tmp/qwen-table-wrap-ansi/fixed/summary.json` | ||
| - Fixed raw ANSI: `/tmp/qwen-table-wrap-ansi/fixed/raw.ansi.log` | ||
| - Fixed screenshot: `/tmp/qwen-table-wrap-ansi/fixed/table-inline-code-wrap.png` | ||
|
|
||
| What this proves: | ||
|
|
||
| - The unfixed table renderer emits the wrapped table-name continuation without a | ||
| code foreground color. | ||
| - The fixed table renderer emits the same continuation with active truecolor | ||
| foreground while preserving the final rendered table. | ||
|
|
||
| What this does not prove: | ||
|
|
||
| - It does not validate non-table inline code or fenced code blocks; those use | ||
| Ink React `<Text color=...>` rendering instead of the table ANSI-string path. | ||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion] The
QWEN_TUI_E2E_REPOpath is hardcoded to a developer-local directory. Other contributors cannot reproduce these commands as-is.Consider replacing with a relative path or a placeholder like
<path-to-base-worktree>so the E2E test plan is reproducible by anyone.— glm-5.1 via Qwen Code /review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in b5f93c2. The Commands block now starts with
FIX_REPO=<path-to-fix-worktree>/BASE_REPO=<path-to-base-worktree>placeholders and theQWEN_TUI_E2E_REPO,cd, and innercd packages/cliinvocations all consume those vars, so anyone with two checkouts (one on this branch, one pinned at the merge-base) can run the plan verbatim.