Skip to content

fix(tui): improve markdown table column allocation#24346

Merged
fcoury-oai merged 1 commit into
mainfrom
fcoury/fix-md-table
May 25, 2026
Merged

fix(tui): improve markdown table column allocation#24346
fcoury-oai merged 1 commit into
mainfrom
fcoury/fix-md-table

Conversation

@fcoury-oai

@fcoury-oai fcoury-oai commented May 24, 2026

Copy link
Copy Markdown
Contributor

Why

Markdown tables with a long path-heavy column could allocate almost all available width to that column and collapse neighboring prose columns to only a few characters. In rollout summaries this made Unit and What It Adds difficult to read, even though the long Files values were the content best suited to wrapping.

The affected example also specified Files as right aligned in its markdown delimiter (---:). This change preserves that requested alignment while improving how width is distributed.

Before After
image image

What Changed

  • Classify table columns as narrative, token-heavy, or compact during width allocation.
  • Shrink token-heavy path and URL columns before shrinking narrative prose, while preserving compact counts and short labels longest.
  • Use readable soft floors for narrative and token-heavy content before falling back to tighter layouts.
  • Add snapshot coverage for a rollout-shaped table containing right-aligned file paths and prose columns.

How to Test

  1. Render a markdown table with Unit, right-aligned Files, Adds, Removes, and What It Adds columns at a constrained terminal width.
  2. Put long repository paths in Files and sentence-length content in Unit and What It Adds.
  3. Confirm that Files remains right aligned but wraps before the narrative columns become unreadable.
  4. Confirm that the compact numeric columns remain easy to scan.

Targeted tests:

  • just test -p codex-tui markdown_render

Validation note: just test -p codex-tui was also attempted and reached two existing unrelated failures in app::tests::update_feature_flags_disabling_guardian_*; the markdown rendering regression test passes in the targeted run.

@etraut-openai etraut-openai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a reasonable heuristic to address this problem.

Code looks good.

I built locally and compared before and after, and the fix appears to work.

@fcoury-oai fcoury-oai merged commit 20d1b76 into main May 25, 2026
31 checks passed
@fcoury-oai fcoury-oai deleted the fcoury/fix-md-table branch May 25, 2026 18:09
@github-actions github-actions Bot locked and limited conversation to collaborators May 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants