Skip to content

Fix layout consistency across all widths - #118

Merged
tmck-code merged 2 commits into
mainfrom
fix/layout-width-consistency
Aug 15, 2026
Merged

Fix layout consistency across all widths#118
tmck-code merged 2 commits into
mainfrom
fix/layout-width-consistency

Conversation

@tmck-code

Copy link
Copy Markdown
Owner

Context

Refine the statusline layout so it's consistent and well behaved at all widths. An exhaustive width sweep (40–200, dense 60–130, ascii-mode analysis) surfaced five layout bugs — justify-mode padding asymmetry, misaligned leading numbers, digits flush against borders, ascii-mode pill corners erasing border structure — plus a threshold inconsistency where the plugin row appeared at a narrower width than the context row's rich form. This PR fixes all of them and bumps the version to v0.7.1.

Changes

Justify-mode centering

  • The elapsed timer baked left-heavy padding into its string via rjust(8) before layout's fair 50/50 split, leaving it visibly off-center; the value is now centered by the justify pass itself.
  • The rebalance also runs when a sibling field consumes all row slack in the same pass (previously still asymmetric at widths 102/112).

Row padding & border adjacency

  • Leading numbers on the context-fill and input-token rows now column-align, with reserved width so a value growing 25.9K123.0K doesn't shift alignment or touch a border.
  • The model section's non-pill branch gained its missing trailing space, so digits never sit flush against the closing border (widths 79–81).

ASCII glyph mode

  • Pill corner glyphs mapped to ' ' and could erase structural border elbows/corners; they now map to +.

Width-threshold alignment

  • TOKENS_COST_MIN_WIDTH now references MEDIUM_WIDTH (85 → 80 box width), so the rich context row (150.0K (75%) 100%) and the tokens/cost dividers appear from the wide layout's floor — removing the terminal-width 86–90 band where the plugin row showed but the context row stayed degraded.

Checklist

  • Tests added or updated for new/changed behaviour
  • (bug fixes) a regression test now covers the situation so it can't come back
  • N/A — no behaviour change, because:

Screenshots / recording

before / after
kitchen-sink kitchen-sink
justify-108 justify-108
context-86 context-86
model-row-80 model-row-80
ascii-pill-108 ascii-pill-108
  • N/A — no visible change

Benchmark

Command Mean [ms] Min [ms] Max [ms] Relative
main 54.1 ± 7.5 43.4 81.2 1.08 ± 0.19
PR 50.2 ± 5.7 43.2 78.5 1.00
  • N/A — no performance-relevant change

System info

Key Value
OS Linux archlinux 7.1.5-arch1-1 #1 SMP PREEMPT_DYNAMIC Sun, 26 Jul 2026 00:49:06 +0000 x86_64 GNU/Linux
Claude Code 2.1.233 (Claude Code)
Terminal TERM=tmux-256color TERM_PROGRAM=tmux SHELL=/bin/bash COLORTERM=truecolor
Locale LANG=en_AU.UTF-8 LC_ALL=
Python Python 3.13.13
uv uv 0.11.32 (3010295ae 2026-07-23 x86_64-unknown-linux-gnu)

🤖 Generated with Claude Code

Test and others added 2 commits August 15, 2026 10:58
- Center the elapsed timer properly in justify mode: drop the baked-in
  rjust padding and rebalance even when a sibling field consumes all
  slack in the same pass (widths 102/112)
- Align leading numbers on the context-fill and input-token rows, with
  reserved width so growing values (25.9K -> 123.0K) don't shift
  alignment or touch a border
- Add a trailing space to the model section's non-pill branch so digits
  never sit flush against the closing border (widths 79-81)
- Map ascii-mode pill corner glyphs to '+' instead of ' ' so a pill can
  no longer erase structural border elbows/corners
- Align TOKENS_COST_MIN_WIDTH with MEDIUM_WIDTH so the rich context row
  and tokens/cost dividers appear from the wide layout's floor,
  removing the inconsistent terminal-width 86-90 band

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tmck-code
tmck-code marked this pull request as ready for review August 15, 2026 01:08
@tmck-code
tmck-code merged commit b1d9bf7 into main Aug 15, 2026
6 checks passed
@tmck-code
tmck-code deleted the fix/layout-width-consistency branch August 15, 2026 01:25
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