fix(helpbar): bound header to its box so it can't scramble the screen#378
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
systeminfoview.Height(6) lines (app/view.go:55), buthelpbar.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.MaxWidth/MaxHeightbackstop 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-orphanedminColWidthfield/setter.Test Plan
go test ./...golangci-lint run ./...TestView_NeverOverflowsBoxsweeps widths 60→200 assertingHeight==6andWidth≤w(locks the previously-broken 112–124 band); plus graceful-degradation and over-long-label tests.swarmcli-bebuilds against the changed API.