Repository navigation
fix(cli): size result table columns by terminal cell width - #1977
Merged
Merged
Conversation
print_rows measured each cell with len(), so a CJK operation name, where every character takes two terminal cells, pushed the following columns right of the header and the Results table looked misaligned. Cells are now measured with rich.cells.cell_len after the existing ANSI strip: wide and fullwidth characters take two cells, and combining marks and emoji modifiers take none, so rows that already lined up keep doing so. rich is already installed through cyclopts; it is now declared directly, at 13.7.1, the first release that gives an emoji skin tone modifier no width. Fixes pyinfra-dev#1438
wowi42
approved these changes
Oct 13, 2026
wowi42
left a comment
Collaborator
There was a problem hiding this comment.
Fixes #1438: print_rows measured cells with len(), so CJK operation names shifted the Results table. Cells are now measured with rich.cells.cell_len after the ANSI strip, and rich is declared as a direct dependency at >=13.7.1.
Checks performed:
- Base is 3.x, title is Conventional Commits, all CI green (tests-done, lint, type-check, unit/e2e on all platforms).
- Fix verified locally: cell_len on installed rich 15.0.0 returns 4 for 中文, 2 for 👍🏽, 0 for combining marks, 5 for ANSI-wrapped "hello". Ran the patched print_rows algorithm verbatim against all four new tests in tests/test_cli/test_cli_prints.py: all pass, including ASCII output byte-identical to before (no regression for existing users).
- rich was already a transitive dep via cyclopts; making it direct is correct since prints.py now imports it. The 13.7.1 floor matches the rich changelog ("Updated the widths of some characters"). The uv.lock change is the minimal 2-line registration of the new direct dep, not bundled lock maintenance.
- No shell commands touched, no injection surface. No asserts in src/. No fixtures needed: this is CLI display code, and tests/test_cli/ already uses plain Python tests.
- Scope is atomic: 4 files, all tied to the fix. rich>=13.7.1 has no upper bound, consistent with existing unbounded deps (click>2, gevent>=1.5).
- AI_POLICY.md followed: full disclosure in the body, human review and testing stated.
Author
|
Thanks for reviewing and merging this, @wowi42. If it's ever useful, open-source repos can use Orbi Cloud free for 3 months to take a first pass at labeled issues here. Just ping me. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
print_rows measured each cell with len(), so a CJK operation name, where every character takes two terminal cells, pushed the following columns right of the header and the Results table looked misaligned.
Cells are now measured with rich.cells.cell_len after the existing ANSI strip: wide and fullwidth characters take two cells, and combining marks and emoji modifiers take none, so rows that already lined up keep doing so. rich is already installed through cyclopts; it is now declared directly, at 13.7.1, the first release that gives an emoji skin tone modifier no width.
Fixes #1438
3.xat this time)scripts/dev-test.sh)scripts/dev-lint.sh)conventional commits format
AI disclosure: the commit is authored by
orbi-build[bot], the GitHub App identity of Orbi, an AI coding agent (deepseek-flash) that wrote the first version. I then reworked it with Claude Code after a review found it made emoji-modifier rows worse, and I reviewed and tested the final diff myself, including runningpyinfra @local execwith the issue's example. I'm opening this PR and am responsible for it.