Skip to content

fix(ansi): align table columns by visible width when cells have ANSI styles - #355

Merged
farnabaz merged 2 commits into
mainfrom
fix/ansi-table-ansi-width
Aug 14, 2026
Merged

fix(ansi): align table columns by visible width when cells have ANSI styles#355
farnabaz merged 2 commits into
mainfrom
fix/ansi-table-ansi-width

Conversation

@farnabaz

@farnabaz farnabaz commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

What

Fixes table column misalignment in @comark/ansi when cells contain ANSI-styled content (inline code, bold, italic, links). Column width is now measured and padded by visible terminal width via stripAnsi / visibleLength / padEndVisible, with regression tests covering the issue case from #354.

resolves #354

Why

The table handler used String.length and padEnd on already-styled cell text. Escape sequences inflated the measured width, so borders drifted whenever a cell had ANSI styling — as reported in #354 for `guard` inside a table. Visible-width math is the standard fix for terminal layout and keeps coloring intact while aligning columns correctly.

…styles

Table column width used String.length on styled cell text, so escape
codes inflated padding and broke borders for inline code/bold/etc.
Measure and pad by visible length instead (#354).
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comark Ready Ready Preview Aug 13, 2026 12:59pm
comark-json-render Ready Ready Preview Aug 13, 2026 12:59pm
comark-nextjs Ready Ready Preview Aug 13, 2026 12:59pm
comark-nuxt Ready Ready Preview Aug 13, 2026 12:59pm
comark-svelte Ready Ready Preview Aug 13, 2026 12:59pm
comark-sveltekit Ready Ready Preview Aug 13, 2026 12:59pm
comark-twoslash Ready Ready Preview Aug 13, 2026 12:59pm
comark-vue Ready Ready Preview Aug 13, 2026 12:59pm

@pkg-pr-new

pkg-pr-new Bot commented Aug 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

comark

npm i https://pkg.pr.new/comark@355

@comark/angular

npm i https://pkg.pr.new/@comark/angular@355

@comark/ansi

npm i https://pkg.pr.new/@comark/ansi@355

@comark/html

npm i https://pkg.pr.new/@comark/html@355

@comark/nuxt

npm i https://pkg.pr.new/@comark/nuxt@355

@comark/react

npm i https://pkg.pr.new/@comark/react@355

@comark/svelte

npm i https://pkg.pr.new/@comark/svelte@355

@comark/vue

npm i https://pkg.pr.new/@comark/vue@355

commit: e8d340f

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

✅ Bundle snapshot updated

Committed the new snapshot as e8d340f, verified by re-running the bundle check against it.

GitHub suppresses the events a workflow commit would normally raise, so the ci check above may
still show the earlier failure. Re-run it to refresh the status — the snapshot itself is confirmed green.

Produced by this run.

@farnabaz
farnabaz merged commit 00e0873 into main Aug 14, 2026
13 checks passed
@farnabaz
farnabaz deleted the fix/ansi-table-ansi-width branch August 14, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@comark/ansi : Issue with tables and ANSI inside

3 participants