Skip to content

fix: align "No content" table with the base and panel count - #289

Open
MeGaurav4 wants to merge 1 commit into
sharkdp:masterfrom
MeGaurav4:master
Open

fix: align "No content" table with the base and panel count#289
MeGaurav4 wants to merge 1 commit into
sharkdp:masterfrom
MeGaurav4:master

Conversation

@MeGaurav4

Copy link
Copy Markdown

An empty file (e.g. /dev/null) renders a "No content" row whose cell widths were hardcoded for the hexadecimal base with two panels, so the row no longer matched the table borders.

Root cause: the empty-file branch forced base_digits = 2 (hex width) and only ever rendered one panel's worth of cells, regardless of the configured base and panel count.

Fix: drop the hardcoded base override and render one cell per panel using panel_sz(), so the "No content" row matches the borders for every base (binary, octal, decimal, hexadecimal) and any panel count.

Only src/lib.rs is changed, plus 3 regression tests for non-hex empty-file output.

Closes #288

Verification

  • hexyl /dev/null --base=binary|octal|decimal|hexadecimal all render aligned tables
  • Hexadecimal output is byte-identical to before (existing empty_file_passes test passes unchanged)
  • cargo test --all: 59 passed (13 lib + 5 parser + 41 integration)

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.

Empty content in base=binary produces broken table

1 participant