Skip to content

fix: context percentage labels reflect used/remaining state#311

Open
huangguang1999 wants to merge 1 commit intosirmalloc:mainfrom
huangguang1999:upstream-pr/context-percent-labels
Open

fix: context percentage labels reflect used/remaining state#311
huangguang1999 wants to merge 1 commit intosirmalloc:mainfrom
huangguang1999:upstream-pr/context-percent-labels

Conversation

@huangguang1999
Copy link
Copy Markdown

@huangguang1999 huangguang1999 commented Apr 16, 2026

Summary

The Context % and Context % (usable) widgets currently render a static Ctx: / Ctx(u): label regardless of whether the value shown is used or remaining (via the (u) keybind that toggles inverse). So a user glancing at Ctx: 9.3% can't tell whether that's 9.3% used or 9.3% remaining without opening the editor to check the inverse modifier.

This PR makes the label reflect the current state:

  • default (used): Ctx Used: X% / Ctx(u) Used: X%
  • inverse (left): Ctx Left: X% / Ctx(u) Left: X%

The existing keybind label (u)sed/remaining and the editor modifier text (remaining) already communicate these two states; this change just surfaces the same distinction in the rendered output. The Ctx / Ctx(u) prefix is kept so the two widgets remain visually distinguishable from one another and from Context Length's Ctx: 18.6k numeric label.

This is a small UX polish — no behavior change beyond the label string.

Test plan

  • bun test — 731 / 731 pass (including the updated ContextPercentage.test.ts / ContextPercentageUsable.test.ts)
  • bun run lint — clean
  • Manual: run ccstatusline setup, add both Context % widgets, toggle each one via (u), confirm the rendered label flips between Used and Left

Notes

Happy to adjust the exact label wording (e.g. Rem: instead of Left:) if you'd prefer something shorter — I went with Used/Left because they match the mental model of "how much is used" vs "how much is left" and are symmetric in length.

🤖 Generated with Claude Code

Previously the Context % and Context % (usable) widgets always
rendered the static label "Ctx: " / "Ctx(u): ", so a user looking
at "Ctx: 9.3%" could not tell whether 9.3% was used or remaining
without opening the editor to check the inverse toggle.

Now the label reflects the current state:
- default (used):  "Ctx Used: X%"   /  "Ctx(u) Used: X%"
- inverse (left):  "Ctx Left: X%"   /  "Ctx(u) Left: X%"

The existing (u) keybind "(u)sed/remaining" and modifier text
"(remaining)" already named these states; this just surfaces the
same distinction in the rendered status line output. Tests updated
to match.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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