Add row dividers and word-aware column widths to Pi TUI table renderer
Session from pi-mono-sessions on Hugging Face by thomasmustier · MIT · condensed by Coders Talk
Investigate how Pi's TUI renders markdown tables, then add row dividers and enforce minimum column widths based on the longest word per column so long tokens like URLs wrap cleanly.
- +0Prompt · +0How does Pi render tables? Investigate, then cleanly add row dividers and minimum column width = longest word in column.
- +0mAgent did · +0mTraced table rendering to markdown.ts's renderTable(), explaining tokenization, width calculation and rendering steps.
- +4mAgent did · +4mImplemented row dividers and longest-word minimum column widths in markdown.ts, added/updated tests, ran npm run check.
- +8mIntervention · +8mDeveloper asked the agent to preserve codebase style, then pasted a diff showing a multiline ternary that didn't match existing formatting conventions.Why: The ternary style clashed with how the rest of the file was written, so I flagged it and had it converted to an if block.
- +9mAgent did · +9mRewrote the ternary as an if block to match style, then simplified by removing a redundant minimum-width fallback check after discussion.
- +19mPrompt · +19mAdd a minimal way to wrap within a word after x characters (for URLs/filepaths). What should x be?
- +20mAgent did · +20mAdded a capped longest-word width (initially 24, then changed to 30 chars per follow-up request) so long unbroken tokens wrap, with matching test coverage.
- +30mAgent did · +30mCommitted changes and pushed to a fix-table-rendering branch on the developer's fork (tmustier/pi-mono).
- +39mAgent did · +39mChecked CONTRIBUTING.md, ran ./test.sh, then added a narrow-width redistribution path (shrinking capped minimums proportionally down to 1-char columns) so capped tables still render correctly, committed and pushed a second fix.
- +1h 1mOutcome · +1h 1mTwo commits pushed to fix-table-rendering branch on fork; npm run check and ./test.sh passing; write-up and GitHub issue summary drafted describing row dividers plus capped, redistributable column widths.
I'd start by asking for the investigation and the two features (row dividers, longest-word minimum width) together, since that's basically what I ended up doing anyway. The correction that mattered was pushing back on style consistency early — catching the multiline ternary kept the diff from drifting from the codebase's conventions, and the later back-and-forth about whether the 30-char cap was redundant with redistribution actually surfaced a real edge case I needed to handle.