Repository navigation
fix(terminal): correct compact and unicode widths - #1129
Conversation
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds the unicode-width crate, updates character display-width calculation to use UnicodeWidthChar::width (with 0 fallback) and tests, and refines column-fitting to compute an overflow-aware first-column minimum passed into fit_widths_to_terminal. ChangesUnicode Character Width and Table Fitting
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai please review this stacked follow-up. It contains the compact-date and Unicode-width behavior fixes requested on #1127. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
ccusage-guide | 26f3a6f | Commit Preview URL Branch Preview URL |
May 23 2026, 01:56 PM |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 7100
Review of
|
| Area | Status |
|---|---|
| Compact date width logic | ✅ Correct — optional simplification nit |
unicode-width integration |
✅ Significant improvement over old blanket else → 2 |
width_cjk vs width choice |
|
| Tests | ✅ Core cases covered; missing char_display_width edge cases |
| Dependency version | ✅ Latest, no known vulnerabilities |
The main actionable item is the width_cjk / width question — worth a deliberate choice with a comment explaining why, either way.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai pushed 0e8eacc to address the standard Unicode width review note: it now uses UnicodeWidthChar::width, keeps controls at zero width, covers ambiguous-width characters in tests, and simplifies the compact-date width condition. Please review again. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 13251
The [approve] |
Fix the terminal table width logic called out during review in a follow-up commit stacked on the terminal split. The compact date mode now lowers the first-column minimum only when the table is actually too wide, which lets date compaction render in narrow layouts. Width calculation now uses unicode-width so combining marks and CJK glyphs do not distort table and title layout. This is separate from the mechanical module split so the first PR can stay behavior-preserving.
Use unicode-width standard width calculation for terminal table output so ambiguous-width characters are measured like non-CJK terminal columns while CJK and combining marks still render with their expected widths. Simplify the compact-date minimum width condition to keep the behavior explicit: preserve a 12-column date only when compact dates are enabled and the table already fits, otherwise allow the 10-column compact form. Add direct width cases for ASCII, CJK, combining marks, controls, and ambiguous characters.
0e8eacc to
26f3a6f
Compare
|
@coderabbitai rebased this follow-up onto main after #1127 was merged, preserving only the compact-date and Unicode-width fixes in this PR. Please review the updated diff again. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 9414
The only diff artifact from the rebase is the [approve] |
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runner startupExecution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one
Cached bunx execution performanceRuns the same large fixture through Fixtures: Claude
Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runner startupExecution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one
Cached bunx execution performanceRuns the same large fixture through Fixtures: Claude
Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runner startupExecution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one
Cached bunx execution performanceRuns the same large fixture through Fixtures: Claude
Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runner startupExecution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one
Cached bunx execution performanceRuns the same large fixture through Fixtures: Claude
Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
Addresses the terminal behavior findings from CodeRabbit on #1127 in a separate stacked PR so the module split can remain mechanical.
This fixes compact date rendering in narrow terminal tables and replaces the ad-hoc non-ASCII width calculation with unicode-width.
@coderabbitai please review this follow-up PR. It intentionally contains the behavior changes that were kept out of #1127.
Testing:
Summary by cubic
Fixes compact date rendering in narrow terminal tables and switches to standard Unicode width calculation. Tables now align correctly with CJK, combining marks, and ambiguous-width characters.
Bug Fixes
unicode-widthfor display width: CJK=2, combining marks/controls=0, ambiguous-width treated as narrow; tests added.Dependencies
unicode-width0.2.2.Written for commit 26f3a6f. Summary will update on new commits. Review in cubic
Summary by CodeRabbit