Skip to content

fix: clamp omarchy commands table to terminal width - #10847

Open
harlanljones wants to merge 2 commits into
omacom:quattrofrom
harlanljones:fix/commands-table-width
Open

harlanljones wants to merge 2 commits into
omacom:quattrofrom
harlanljones:fix/commands-table-width

Conversation

@harlanljones

Copy link
Copy Markdown
Contributor

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.

@johnpippett johnpippett left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tested commit 784f14cc8a2d7d972ced8b6787541196646f6c8a against base commit 5b91db503c904bbfc5f34bdaaa9c708814958f3d.

  • All 112 assertions in ./test/cli passed.
  • Compared command output in pseudo-terminals with widths of 40, 60, 73, 80, 120, and 160 columns.
  • At 73 columns, the description for omarchy ascii starts at column 48. It starts at column 221 in the base version.
  • Command text and descriptions remain complete at each tested width.
  • With COLUMNS set to 73, 0, or invalid, the description starts at column 48. Without TERM, the formatter uses 80 columns.
  • commands --json and commands --markdown produced 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.

@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
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>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

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 COLUMNS unset (so the tput path is what runs), counting the 402 rows of omarchy commands wider than the terminal:

Terminal quattro this PR before with 044f21b
80 columns 392 377 338
120 columns 392 375 201
200 columns 392 375 21

The commit clamps the column to half the terminal instead. It also adds a regression test to test/cli, as @johnpippett asked: at COLUMNS=120, the summary of a short command must start within the first 64 characters. The test fails on quattro and on the original commit alone, and passes with the fix. Usages longer than the column still push their own summary along, and nothing is truncated.

Tests. ./test/cli passes 113/113 on this branch. Merged into current quattro, it passes everything except vscode generated theme references current theme file, which fails the same way on quattro without this change.

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 COLUMNS value with a leading zero would be read as octal. I left that alone: shells set COLUMNS in decimal, and bin/omarchy-provision-owner validates the same way.

This closes #10819. It now waits on CI, which has not reported yet, and then on the maintainer.

@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Low risk] Adjusts help text table layout to fit terminal width.

The PR appears safe to merge, with a non-blocking edge case in terminal-width parsing.

Findings

  1. P2 Leading-zero widths parse incorrectly ▶

Summary

The PR caps padding in human-readable command tables at half the detected terminal width, so one long usage no longer pads every row to its length. It adds a CLI regression test for the 120-column layout.

Reviews (1) · Last reviewed commit: "Clamp the commands column to half the te..."

Comment thread bin/omarchy
Comment on lines +581 to +583
[[ $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 ))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 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.

omarchybot pushed a commit to Raj-Jagadeesh-A-P/omarchy that referenced this pull request Nov 11, 2026
…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>
dhh added a commit that referenced this pull request Nov 16, 2026
…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>
@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Nov 16, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

#13237 was merged into quattro today. It fixes #10819, the same bug this pull request fixes, by changing the same lines in bin/omarchy and test/cli. That is why this branch no longer merges cleanly.

What was compared. I read both diffs against current quattro. Both fix the cause in print_command_table(): they cap the usage column, so one usage longer than 200 characters no longer pads every row. #13237 caps the column at a fixed 48 characters. This branch caps it at half the terminal width, with a minimum of 20. The test in #13237 is adapted from the one here, with @harlanljones credited as co-author.

What this branch would still change. On top of quattro it fixes nothing more; it only changes the layout. A short command's summary starts at column 53 on quattro at every width. With this branch it would start at column 45 at 80 columns, 65 at 120, and 105 at 200. Choosing between a fixed cap and a width-dependent one is a layout decision, not a defect quattro still has. The COLUMNS=120 test on this branch also passes on quattro without this change, so it no longer guards anything this branch adds.

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 COLUMNS is stale or very wide, for example while output is piped to a file, the column widens again, and a value around 430 or more brings back the original padding. Codex repeated the earlier note that a COLUMNS value with a leading zero is read as octal.

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 quattro through #13237.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omarchy commands listing is misaligned

3 participants