Give the usage bars a line of their own, always

Squeezing the 5h/7d group onto line one was what cost the reset times and
the pace figure at laptop width, and it made the layout jump between one
and two lines as the branch name or the cost changed width. Line two is
now the group's own at every terminal size, so both timestamps and the
burn rate fit; the ladder only starts giving things up below ~80 columns.

The bars also survive down to 35 columns now rather than being dropped
below 68, since a line of their own is all they need. Every rung of the
ladder is fit-checked, the last one included: with the floor that low, a
percentage the API reports in more digits than anyone expects would
otherwise have overflowed the line rather than dropped the group.

The two timestamps still cost ~10 subprocesses to format on a line that
redraws per keystroke, so that is skipped when line two provably cannot
show them -- an under-estimate, so the fit check stays the decider.

With nothing left to squeeze, WRAP_NARROW, the wrap band and the split
tier go: line one is the full tier down to 150, wide to 68, then narrow.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonny Barnes 2026-09-03 16:51:05 +01:00
commit ab96dfc52a
No known key found for this signature in database
7 changed files with 148 additions and 155 deletions

View file

@ -124,13 +124,13 @@ out=$(render 245)
|| bad "30min old: refetched, not held for the hour" "$out"
# ------------------------------------------------- bars shown => bars refreshed
# The refresh is gated on the same tier check as the bars themselves, so the
# two must agree at every width: wrapped onto line two included, and 68 being
# WRAP_FLOOR, the narrowest width that still shows them.
# The refresh is gated on the same width check as the bars themselves, so the
# two must agree at every width, 35 being RL_MIN_WIDTH -- the narrowest usable
# width the bars still fit on their own line.
echo
echo "Every width that shows the bars refreshes them:"
for u in 245 115 85 68; do
for u in 245 115 85 68 50 35; do
cached_response_aged 360
out=$(render "$u")
if case "$out" in *"5h"*) true ;; *) false ;; esac; then
@ -141,14 +141,14 @@ for u in 245 115 85 68; do
fi
done
# One column below the wrap floor the group is dropped entirely — nothing is
# One column below RL_MIN_WIDTH the group is dropped entirely — nothing is
# shown, so nothing should be paid for either.
cached_response_aged 360
out=$(render 67)
case "$out" in *"5h"*) bad "usable 67: no bars at the narrow tier" "$out" ;;
*) ok "usable 67: no bars at the narrow tier" ;; esac
[ "$(calls)" = "0" ] && ok "usable 67: no API call when no bars are shown" \
|| bad "usable 67: no API call when no bars are shown" "$out"
out=$(render 34)
case "$out" in *"5h"*) bad "usable 34: no bars below the group's floor" "$out" ;;
*) ok "usable 34: no bars below the group's floor" ;; esac
[ "$(calls)" = "0" ] && ok "usable 34: no API call when no bars are shown" \
|| bad "usable 34: no API call when no bars are shown" "$out"
# --------------------------------------------------------- offline retry backoff
# With no network, curl can burn --max-time 10 before giving up. A failed fetch