Repository navigation
fix: clamp omarchy commands table to terminal width - #10847
harlanljones wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Tested commit 784f14cc8a2d7d972ced8b6787541196646f6c8a against base commit 5b91db503c904bbfc5f34bdaaa9c708814958f3d.
- All 112 assertions in
./test/clipassed. - Compared command output in pseudo-terminals with widths of 40, 60, 73, 80, 120, and 160 columns.
- At 73 columns, the description for
omarchy asciistarts at column 48. It starts at column 221 in the base version. - Command text and descriptions remain complete at each tested width.
- With
COLUMNSset to73,0, orinvalid, the description starts at column 48. WithoutTERM, the formatter uses 80 columns. commands --jsonandcommands --markdownproduced the same output in both versions.
The tests recorded output from pseudo-terminals in an isolated environment. This confirms the padding change for the 73-column case reported in #10819.
Please add a regression test for a narrow terminal with a long command usage.
A 30-column reserve still left most summaries wrapping: the longest usage is over 200 characters, so on a 120-column terminal the column was clamped to 90 and 375 of 402 rows ran past the edge. Half the width leaves summaries room at every size and cuts that to 201, and to 21 at 200 columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed and verified on a disposable Omarchy VM. I pushed one commit to this branch (044f21b) on top of the fix. What changed. A command column of terminal width minus 30 still left 30 columns for summaries, and most summaries are longer than that. The longest usage is over 200 characters, so the column was always clamped, and nearly every row still ran past the edge. In a pty with
The commit clamps the column to half the terminal instead. It also adds a regression test to Tests. Second opinion. Codex Medium reviewed it twice. The first round agreed the bug is real and the change proportionate, and caught a regex in the new test that escaped spaces where the house style quotes literals; that is fixed. The second round found nothing open. It saw my measurements before reviewing, so its agreement is not guaranteed to be independent. It also noted that a This closes #10819. It now waits on CI, which has not reported yet, and then on the maintainer. |
|
| [[ $term_width =~ ^[0-9]+$ ]] && (( term_width > 0 )) || term_width=$(tput cols 2>/dev/null || echo 80) | ||
| [[ $term_width =~ ^[0-9]+$ ]] && (( term_width > 0 )) || term_width=80 | ||
| local cap=$(( term_width / 2 )) |
There was a problem hiding this comment.
Leading-zero widths parse incorrectly. The digit check accepts values such as
COLUMNS=0100, but Bash reads them as octal, giving a 32-column cap instead of 50. COLUMNS=08 prints an arithmetic error before falling back. This is a non-blocking layout and diagnostic issue; parse the validated width as decimal.
…acters Adapted from the test on omacom#10847, which fixes the same bug with a different cap: a short command's summary must start within the capped column, not after the longest usage in the table. It fails when the cap is removed. Co-Authored-By: Harlan Jones <harlanljones@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…3237) * Cap the command list column width to keep summaries from wrapping * Correct the command column comment's example The comment named agent usage update as the usage pushing the column past 90 characters, but that usage is 82; the ones the cap exists for are over 200. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Say that any usage over the cap pushes only its own summary The comment named usages past 200 characters, but every usage longer than 48 characters is the case the cap handles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Test that the commands table pads its usage column to at most 48 characters Adapted from the test on #10847, which fixes the same bug with a different cap: a short command's summary must start within the capped column, not after the longest usage in the table. It fails when the cap is removed. Co-Authored-By: Harlan Jones <harlanljones@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Omarchybot <317366263+omarchybot@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: David Heinemeier Hansson <david@hey.com> Co-authored-by: Harlan Jones <harlanljones@gmail.com>
|
#13237 was merged into What was compared. I read both diffs against current What this branch would still change. On top of Second opinion. Codex Medium and muse-wonder (via pi, thinking high) compared the two diffs. They were not given my conclusion, but their independence is not guaranteed. Both said #13237 fixes the bug and that what remains here is a layout choice. muse-wonder added a point of its own: this cap has no upper bound. When Not run. Nothing was run on a worker this time. #13237 has already been merged and verified, so testing this branch again would not inform the decision. This now waits on the maintainer: close it as covered by #13237, or keep a width-dependent cap instead of the fixed 48. Thank you @harlanljones for the fix and the test; the test is now part of |
Closes #10819. print_command_table() padded every row to the longest usage (up to 216 chars), wrapping all output on normal terminals. The command column is now clamped to terminal width minus a summary reserve; overlong usages overflow on their own row. Verified: test/cli 112/112 green.