Skip to content

fix(list): wrap long regex cells instead of truncating#14

Merged
nnemirovsky merged 3 commits intomainfrom
fix/list-table-wrap
Apr 15, 2026
Merged

fix(list): wrap long regex cells instead of truncating#14
nnemirovsky merged 3 commits intomainfrom
fix/list-table-wrap

Conversation

@nnemirovsky
Copy link
Copy Markdown
Owner

Summary

  • /passthru:list table no longer truncates long regex match values with "..." ellipsis.
  • Long cells now wrap across multiple lines with continuation lines padded so column alignment holds.
  • Terminal width is detected via COLUMNS then tput cols then 120 fallback. Column budgets are dynamic: tool min 12 / max 20 chars, match 60% of remainder, reason 40%.
  • Breaks prefer space / pipe / comma within the last quarter of the column width, with hard break fallback.
  • JSON and raw formats unchanged.

Test plan

  • bats tests/*.bats passes (549 passing, up from 546 baseline)
  • Truncation test inverted to assert full regex present (no ellipsis)
  • New test: continuation lines pad # and tool columns (grouped renderer)
  • New test: continuation lines pad scope/list/source/#/tool columns (flat renderer)
  • New test: extremely narrow terminal still prints full regex

The /passthru:list table used to truncate the match-summary column at
40 (flat) or 50 (grouped) characters with a "..." ellipsis, hiding the
trailing part of long regexes. Users shown only half of a regex cannot
validate what rule they're about to keep or remove.

This commit removes the truncate_str helper, detects terminal width
(COLUMNS, tput cols, 120 fallback), allocates column budgets dynamically
(tool min 12 / max 20 chars, match 60% of remainder, reason 40%), and
wraps overflow across continuation lines. Continuation lines pad the
leading columns (scope/list/source/#/tool) with spaces so wrapped text
remains aligned under its column header. Breaks prefer space / pipe /
comma within the last quarter of the column width, with a hard break
fallback.

JSON and raw output formats are unchanged.
SC1087 complained about `${#$arr_name[@]}` inside eval because it saw
the bare variable without braces as an array index. Wrap the name in
braces so the resolved form is unambiguous.
@nnemirovsky nnemirovsky merged commit b668992 into main Apr 15, 2026
2 checks passed
@nnemirovsky nnemirovsky deleted the fix/list-table-wrap branch April 15, 2026 10:24
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.

1 participant