fix(ansi): align table columns by visible width when cells have ANSI styles - #355
Merged
Conversation
…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).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
comark
@comark/angular
@comark/ansi
@comark/html
@comark/nuxt
@comark/react
@comark/svelte
@comark/vue
commit: |
Contributor
✅ Bundle snapshot updatedCommitted 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 Produced by this run. |
atinux
approved these changes
Aug 13, 2026
arashsheyda
approved these changes
Aug 13, 2026
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.
What
Fixes table column misalignment in
@comark/ansiwhen cells contain ANSI-styled content (inline code, bold, italic, links). Column width is now measured and padded by visible terminal width viastripAnsi/visibleLength/padEndVisible, with regression tests covering the issue case from #354.resolves #354
Why
The table handler used
String.lengthandpadEndon 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.