What do you want to change?
When you run e.g., ccussage opencode monthly, as opposed to ccusage monthly (no agent specied), the Models column balloons, and the other columns become illegible. This applies to all periods (daily, monthly, etc).
Why?
It makes the tables illegible in single-agent mode.
How? (optional)
Fix is straighforward.
Analysis:
Affected commands: ccusage <agent> <period> for all agents and all periods (daily, weekly, monthly, session). Example: ccusage opencode monthly --since 20260501 --offline
Not affected: ccusage <period> (the aggregate/all-agents report)
Root cause: column_widths() in rust/crates/ccusage-terminal/src/table.rs uses visible_width_sum() to measure cells at index 1. visible_width_sum adds the widths of all lines in the cell together, so a Models column with 13 models listed on separate lines gets measured as ~286 chars wide instead of ~25 (the widest single model name). This causes fit_widths_to_terminal() to allocate ~80%+ of terminal width to the Models column, clamping numeric columns to their minimums (8-10 chars).
In the aggregate report, index 1 is the Agent column (single-line values), so visible_width_sum ≈ visible_width_max_line and the bug is hidden.
Fix: In column_widths(), remove the two if index == 1 special cases that call visible_width_sum() — just use visible_width_max_line() unconditionally, which the else branch already does for all other columns. Two lines deleted, zero lines added. visible_width_max_line returns the width of the widest single line in the cell — the correct metric for column width. Existing minimums and fit_widths_to_terminal() scaling still apply.
File: rust/crates/ccusage-terminal/src/table.rs
Function: SimpleTable::column_widths() (~lines 102-148)
What do you want to change?
When you run e.g.,
ccussage opencode monthly, as opposed toccusage monthly(no agent specied), the Models column balloons, and the other columns become illegible. This applies to all periods (daily, monthly, etc).Why?
It makes the tables illegible in single-agent mode.
How? (optional)
Fix is straighforward.
Analysis:
Affected commands:
ccusage <agent> <period>for all agents and all periods (daily, weekly, monthly, session). Example:ccusage opencode monthly --since 20260501 --offlineNot affected:
ccusage <period>(the aggregate/all-agents report)Root cause:
column_widths()inrust/crates/ccusage-terminal/src/table.rsusesvisible_width_sum()to measure cells at index 1.visible_width_sumadds the widths of all lines in the cell together, so a Models column with 13 models listed on separate lines gets measured as ~286 chars wide instead of ~25 (the widest single model name). This causesfit_widths_to_terminal()to allocate ~80%+ of terminal width to the Models column, clamping numeric columns to their minimums (8-10 chars).In the aggregate report, index 1 is the Agent column (single-line values), so
visible_width_sum≈visible_width_max_lineand the bug is hidden.Fix: In
column_widths(), remove the twoif index == 1special cases that callvisible_width_sum()— just usevisible_width_max_line()unconditionally, which theelsebranch already does for all other columns. Two lines deleted, zero lines added.visible_width_max_linereturns the width of the widest single line in the cell — the correct metric for column width. Existing minimums andfit_widths_to_terminal()scaling still apply.File:
rust/crates/ccusage-terminal/src/table.rsFunction:
SimpleTable::column_widths()(~lines 102-148)