Skip to content

Better handle empty headers in vertical table#114

Merged
rolandwalker merged 1 commit into
mainfrom
RW/better-handle-empty-headers
Jul 25, 2026
Merged

Better handle empty headers in vertical table#114
rolandwalker merged 1 commit into
mainfrom
RW/better-handle-empty-headers

Conversation

@rolandwalker

Copy link
Copy Markdown
Contributor

Description

If the headers parameter was an empty list, the header_len calculation in vertical_table() would raise.

In addition, a later zip() would have dropped elements.

To fix this, synthesize header elements of only spaces, based on the first row of data, when data is also nonempty.

Just in case headers and data are both empty, provide a fallback so that the header_len calculation does not raise, but computes a zero.

Checklist

  • I've added this contribution to the CHANGELOG.
  • I've added my name to the AUTHORS file (or it's already there).
  • I installed pre-commit hooks (pip install pre-commit && pre-commit install), and ran black on my code.
  • Please squash merge this pull request (uncheck if you'd like us to merge as multiple commits)

If the headers parameter was an empty list, the header_len calculation
in vertical_table() would raise.

In addition, a later zip() would have dropped elements.

To fix this, synthesize header elements of only spaces, based on the
first row of data, when data is also nonempty.

Just in case headers and data are both empty, provide a fallback so that
the header_len calculation does not raise, but computes a zero.
@rolandwalker rolandwalker self-assigned this Jul 25, 2026
@rolandwalker
rolandwalker merged commit f7fd151 into main Jul 25, 2026
2 checks passed
@rolandwalker
rolandwalker deleted the RW/better-handle-empty-headers branch July 25, 2026 12:52
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.

1 participant