Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(helpbar): bound header to its box so it can't scramble the screen#378

Merged
clangenb merged 1 commit into
mainfrom
fix/helpbar-layout-robustness
Jun 1, 2026
Merged

fix(helpbar): bound header to its box so it can't scramble the screen#378
clangenb merged 1 commit into
mainfrom
fix/helpbar-layout-robustness

Conversation

@eldara-cruncher
Copy link
Copy Markdown
Collaborator

Summary

  • The app layout assumes the header is exactly systeminfoview.Height (6) lines (app/view.go:55), but helpbar.View() word-wrapped the help columns at viewport widths ~112–124, rendering 7–8 lines. The overflow pushed the body + stack bar off the alt-screen, causing the scrambled logo and stale terminal-buffer bleed-through seen in the wild.
  • Rewrote the width budgeting: render help columns at natural width, keep only those that fit, and degrade gracefully (drop columns right-to-left, then the logo) as the terminal narrows. Also fixes a latent bug where the header was always 2 cols wider than its given width (unaccounted spacer).
  • Added a hard MaxWidth/MaxHeight backstop so the header can never overflow its box even if the packing math ever regresses. Guarded the edition-label slice against panics and removed the now-orphaned minColWidth field/setter.

Test Plan

  • go test ./...
  • golangci-lint run ./...
  • New TestView_NeverOverflowsBox sweeps widths 60→200 asserting Height==6 and Width≤w (locks the previously-broken 112–124 band); plus graceful-degradation and over-long-label tests.
  • swarmcli-be builds against the changed API.
  • Manual: drill into a stack's services and resize the terminal through the ~116–128 column band — logo stays intact, body never scrolls off-screen, no bleed-through.

The header layout assumed the helpbar was always exactly
systeminfoview.Height (6) lines tall, but View() word-wrapped the help
columns at viewport widths ~112-124, rendering 7-8 lines and pushing the
body off the alt-screen (scrambled logo + stale-buffer bleed-through). It
was also always 2 columns wider than its given width (unaccounted spacer).

Rewrite the width budgeting to pack only the help columns that fit, drop
columns right-to-left then the logo as the terminal narrows, and clamp the
result with MaxWidth/MaxHeight as a hard backstop so the header can never
overflow its box. Guard the edition-label slice against panics and remove
the now-orphaned minColWidth field/setter.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@clangenb clangenb merged commit 2b4409f into main Jun 1, 2026
13 of 16 checks passed
@eldara-cruncher eldara-cruncher deleted the fix/helpbar-layout-robustness branch June 5, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants