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:
parent
2a785a55a7
commit
ab96dfc52a
7 changed files with 148 additions and 155 deletions
|
|
@ -54,10 +54,13 @@ check() { # usable, branch, model, cost, [xfail-reason]
|
|||
[ "$over" = "1" ] && why="line exceeds usable width"
|
||||
# INVARIANT 2: at most two lines
|
||||
[ "$n" -gt 2 ] && why="${why:-more than two lines}"
|
||||
# INVARIANT 3: only wrap when it was actually necessary
|
||||
if [ -z "$why" ] && [ "$n" = "2" ]; then
|
||||
local l1 l2; l1=$(printf '%s\n' "$ws" | sed -n 1p); l2=$(printf '%s\n' "$ws" | sed -n 2p)
|
||||
[ $(( l1 + 3 + l2 )) -le "$u" ] && why="wrapped unnecessarily (would have fit on one line)"
|
||||
# INVARIANT 3: the usage group always gets a line of its own, so that the
|
||||
# reset times and the pace figure have room whatever line one holds. Below
|
||||
# RL_MIN_WIDTH there is no group to wrap, so a single line is expected.
|
||||
if [ -z "$why" ]; then
|
||||
if [ "$u" -ge 35 ] && [ "$n" != "2" ]; then why="usage not on its own line"
|
||||
elif [ "$u" -lt 35 ] && [ "$n" != "1" ]; then why="wrapped with no usage group"
|
||||
fi
|
||||
fi
|
||||
|
||||
local label="usable=$u branch=${#branch}ch model='${model:0:12}' lines=$n max=$mx"
|
||||
|
|
@ -75,7 +78,7 @@ M1="Opus 5"
|
|||
M2="Opus 5 (1M context)"
|
||||
|
||||
echo "Sweep of usable widths, short branch:"
|
||||
for u in 200 155 150 130 116 110 100 95 85 75 68 67 60 40; do check "$u" "$SHORT" "$M1" 0.50; done
|
||||
for u in 200 155 150 130 116 110 100 95 85 75 68 67 60 50 40; do check "$u" "$SHORT" "$M1" 0.50; done
|
||||
# Narrow tier has a ~35-col floor; nothing can fit below that. Verified byte-identical
|
||||
# on the pre-change script, so not a regression.
|
||||
check 25 "$SHORT" "$M1" 0.50 "narrow tier floor ~35 cols"
|
||||
|
|
@ -86,7 +89,7 @@ for u in 200 150 116 100 85 68; do check "$u" "$LONG" "$M2" 4.61; done
|
|||
check 40 "$LONG" "$M2" 4.61 "narrow tier floor ~43 cols with a long branch"
|
||||
echo "Large cost figure:"
|
||||
for u in 116 85 68; do check "$u" "$SHORT" "$M1" 1234.56; done
|
||||
# ... and with a long branch, which is what makes the wrap-mode branch budget
|
||||
# ... and with a long branch, which is what makes the compact-tier branch budget
|
||||
# bite: a four-digit cost is three columns wider than the budget assumed.
|
||||
echo "Large cost figure with a long branch:"
|
||||
for u in 68 69 70 75 85; do check "$u" "$LONG" "$M1" 1234.56; done
|
||||
|
|
|
|||
Loading…
Reference in a new issue