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

@ -214,8 +214,8 @@ import sys,re,unicodedata
for ln in sys.stdin.read().rstrip('\n').split('\n'):
p=re.sub(r'\033\[[0-9;]*m','',ln)
print(sum(2 if unicodedata.east_asian_width(c) in 'WF' else 1 for c in p))"; }
over=0; toomany=0; orphan=0; dropped=0; shown=0
for u in 200 180 160 155 150 145 140 135 130 125 120 116 110 105 100 95 90 85 80 75 70 68; do
over=0; toomany=0; orphan=0; dropped=0; shown=0; missing_wide=0
for u in 200 180 160 155 150 145 140 135 130 125 120 116 110 105 100 95 90 85 80 75 70 68 60 55 50 45 40; do
o=$(render "$MON" 12345 "$u")
ws=$(printf '%s' "$o" | widths)
while read -r c; do [ "$c" -gt "$u" ] && over=1; done <<< "$ws"
@ -224,13 +224,18 @@ for u in 200 180 160 155 150 145 140 135 130 125 120 116 110 105 100 95 90 85 80
# be the last thing standing.
case "$o" in
*"%/d"*) shown=1; case "$o" in *Fable*) ;; *) orphan=1 ;; esac ;;
*) case "$o" in *Fable*) dropped=1 ;; esac ;;
*) case "$o" in *Fable*) dropped=1 ;; esac
[ "$u" -ge 68 ] && missing_wide=1 ;;
esac
done
[ "$over" = 0 ] && ok "no line exceeds the usable width at any width" || bad "no line exceeds the usable width at any width"
[ "$toomany" = 0 ] && ok "never more than two lines" || bad "never more than two lines"
[ "$orphan" = 0 ] && ok "pace never outlives the per-model bar" || bad "pace never outlives the per-model bar"
[ "$shown" = 1 ] && ok "pace is actually rendered somewhere in the sweep" || bad "pace is actually rendered somewhere in the sweep"
# Line two is the group's own, so pace survives every width that fits a normal
# status line -- it is only given up on a genuinely tiny terminal.
[ "$missing_wide" = 0 ] && ok "pace is kept at every width from 68 columns up" \
|| bad "pace is kept at every width from 68 columns up"
[ "$dropped" = 1 ] && ok "the pace rung is reachable: some width keeps the bar but drops pace" \
|| bad "the pace rung is reachable: some width keeps the bar but drops pace"
@ -238,7 +243,7 @@ done
# readout, pace is the number this segment exists for, so the credits go first.
fixture 7.0 "$R_MON_ISO" "$(scoped 0 null)" "$EXTRA_ON"
pace_alone=0; credits_alone=0
for u in 200 180 160 155 150 145 140 135 130 125 120 116 110 105 100 95 90 85 80 75 70 68; do
for u in 200 180 160 155 150 145 140 135 130 125 120 116 110 105 100 95 90 85 80 75 70 68 60 55 50 45 40; do
o=$(render "$MON" 12345 "$u")
case "$o" in
*"%/d"*) case "$o" in *extra*) ;; *) pace_alone=1 ;; esac ;;