Files
codewhale/crates
Hunter Bown 42cccee02d fix(markdown): wrap long table cells instead of truncating with
The previous render_table_row truncated cell content with `…` whenever
a cell's display width exceeded `(terminal_width - 7) / num_cols`. In
narrow terminals or with verbose English/Chinese instructional tables
(common in LLM responses), users would see only the first ~30
characters of meaningful content per cell with the rest silently lost
— not visible by scrolling, not recoverable.

Replace the truncation with a word-wrapping renderer that preserves
the full cell content across multiple visual lines while keeping the
column separators (`│`) aligned on every wrapped continuation line.
The row's visual height becomes the height of the tallest column;
shorter columns get blank-padded continuation rows so column edges
stay aligned.

Algorithm:
- wrap_cell_text splits on whitespace and packs words greedily until
  the next word wouldn't fit; words wider than col_width are
  hard-broken at character boundaries so wrapping always makes
  progress (URLs, paths).
- render_table_row pre-wraps every cell, computes the row height as
  max(cell_segments_len), then emits N visual lines with each cell's
  segment-or-empty padded to col_width and separated by `│`.

Adds two regression tests covering: long cells preserve content (no
`…`) and wrapped continuation lines retain column separators.
2026-05-09 12:34:53 -05:00
..