Skip to content

fix: include single-column spans in automatic column widths - #239

Merged
gajus merged 2 commits into
gajus:masterfrom
n0liu:fix-single-column-span-width
Nov 4, 2026
Merged

gajus merged 2 commits into
gajus:masterfrom
n0liu:fix-single-column-span-width

Conversation

@n0liu

@n0liu n0liu commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Using a single-column spanning cell to center a heading currently excludes that heading from automatic column width calculation. For example, with [['Heading', 'Value'], ['a', '1']] and { row: 0, col: 0, colSpan: 1, alignment: 'center' }, the first column gets width 1 and renders Heading one character per line.

Include the top-left cell of spans that occupy only one column, including row spans with an omitted colSpan. Cells covered by a span and spans covering multiple columns remain excluded. Explicit column widths still take precedence.

Fixes #234.

Validation on Node.js 16.20.2:

  • Added seven tests covering single-column spans, covered cells, multi-column spans, ANSI/multiline display widths, rendered output, and explicit column widths. Five fail before the fix.
  • npm run build
  • npm run lint
  • npm test: 191 passing; 100% statements, branches, functions, and lines.

@gajus
gajus merged commit 429feb0 into gajus:master Nov 4, 2026
10 checks passed
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 6.9.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

column width calculation ignores 1 wide spanning cells.

2 participants