Repository navigation
fix(table): shrink the widest columns first and honor width priorities everywhere - #19303
Merged
Merged
Conversation
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.
Description
Since #19007,
table --expandsqueezed short columns to 4 characters whenever another column held a nested table. The nested-table column took every spare character before any other column grew, so anenvlisting printedSOME_BIG_SESSION_ENV_VARas seven 4-character lines.table --expandalso ignoredmetadata set --table-width-priority-columns. So didtableat 120 columns or less, unless wrapping and header-on-separator were both on.An
env-style listing with nested values,table -e, header on the separator, 100 wide:Before:
After:
A
plugin list-shaped table,table -e, 120 wide:Before:
After:
A record with a 100-character key,
table -w 60:{("k" | fill -c k -w 100): 1, b: 2} | table -w 60Before:
After:
CJK headers with
header_on_separator,table -e: This intentionally doesn't draw the characters on the headers, even when the setting is set to true, in order to avoid misaligned tables. (images convey this better below)Before:

After:

User-facing changes (Release notes)
tableshrinks the widest columns first and honors width priorities everywheretableandtable --expandshrink the widest columns first, so short columns such as keys, names and sizes keep their width next to long text or nested tables.metadata set --table-width-priority-columns, whichlsandpsalso set, now works withtable --expandand at every terminal width. A priority column shows wherever it would without the priority, and columns to its right hide to leave it up to a third of the table width.table --expanddraws a nested table whenever it fits, hiding columns to its right first and collapsing the nested table's own columns behind..., instead of showing[table N rows]. Nested tables no longer drop columns without a...marker.header_on_separatorthis shows more columns on narrow terminals; with it, fewer, since columns are no longer squeezed to 4 characters.header_on_separator, headers with CJK characters, emoji or Arabic ligatures are drawn in their own row, so the table border lines up.Additional notes