Skip to content

feat(tui): right-align the token meter legend's rates in their column - #1064

Merged
edwin-zvs merged 1 commit into
mainfrom
legend-rate-right-align
Aug 1, 2026
Merged

feat(tui): right-align the token meter legend's rates in their column#1064
edwin-zvs merged 1 commit into
mainfrom
legend-rate-right-align

Conversation

@edwin-zvs

Copy link
Copy Markdown
Contributor

Follow-up to #1063. The grid aligned the names; the rates still trailed them, so each figure started wherever its name happened to stop.

--- before (rate trails the name) ---
|● claude-opus-5 4.8k/s   ● claude-sonnet-5 1.2k/s |
|● gpt-5.5-codex idle     ● grok-4 310/s           |
|● gemini-3-pro 90/s      ● claude-haiku-4-5 idle  |
|● qwen3-coder 2.4k/s     |

--- after (rate against the cell edge) ---
|● claude-opus-5   4.8k/s ● claude-sonnet-5 1.2k/s |
|● gpt-5.5-codex     idle ● grok-4           310/s |
|● gemini-3-pro      90/s ● claude-haiku-4-5  idle |
|● qwen3-coder     2.4k/s |

(Layout code's own output at 64 columns, printed from a throwaway test — not a screenshot.)

The rate now hangs off its cell's right edge, one gutter column short so it never butts against the next cell's dot. The slack lands between name and rate, where it separates two things read differently rather than misaligning either. idle right-aligns with the numbers for the same reason — it occupies the same slot.

Cell contents are split out into a small legend_cell helper so the placement is unit-testable rather than only observable on screen. Behaviour that did not change: a cell too narrow for both still drops the rate and keeps the name, truncating the name before dropping the entry; the row's +N overflow marker and the right-aligned Σ fleet total sit after the last cell as before.

Testing

cargo test --workspace green (exit 0, 0 failures). New tests assert the rate ends one gutter short of the cell edge for names of any length with a gap of at least one column, and that a cramped cell drops the rate before the name.

Spec 0167 updated.

Binaries

Only crates/cli changed → the relevant binary is construct:

/Users/moon/agentd/.claude/worktrees/legend-rate-right-align/target/debug/construct

The rate trailed its name, so it started wherever that name happened to
stop — a different offset on every row, and comparing throughputs meant
finding each figure before reading it. It now hangs off its cell's right
edge, one gutter column short, so the rates form a column of their own:

    ● claude-opus-5   4.8k/s ● claude-sonnet-5 1.2k/s
    ● gpt-5.5-codex     idle ● grok-4           310/s
    ● gemini-3-pro      90/s ● claude-haiku-4-5  idle

The slack lands between name and rate, separating two things that are read
differently rather than misaligning either. A cell too narrow for both still
drops the rate and keeps the name, as before — an unnamed color can't be
matched to a band, a missing rate only costs a number.

Spec 0167 updated.
@edwin-zvs
edwin-zvs merged commit cfcb621 into main Aug 1, 2026
1 check passed
@edwin-zvs
edwin-zvs deleted the legend-rate-right-align branch August 1, 2026 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant