fix(widget): centre the Button label instead of on the bottom border - #3
Merged
Conversation
Button.Draw placed the label at Y+2, which is the bottom border row of a short (3/4-tall) cell button — it rendered as "└─OK──┘" — contradicting the type's own "centred label" doc. Draw at the middle row (Y+(H-1)/2): the exact centre in cell mode and an acceptable vertical centre in pixel mode, keeping the backend-agnostic four-line-widget shape. Adds a cell-mode regression test asserting the label is on the centre row and the bottom border is intact. 100% coverage. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
tannevaled
added a commit
to go-widgets/tui
that referenced
this pull request
Jul 9, 2026
Picks up go-widgets/painter#3: painter.Button now draws its label on the button's centre row instead of the bottom border. Visible in tui-snapshot — the buttons now render '│ OK │' with the border intact, not '└─OK───────┘'. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.
Button.Drawplaced the label atY+2, which is the bottom border row of a short (3/4-tall) cell button — it rendered as└─OK──┘, contradicting the type's own "centred label" doc. This surfaced ingo-widgets/tui'stui-snapshotdemo.Draw the label at the middle row (
Y+(H-1)/2) — the exact centre in cell mode and an acceptable vertical centre in pixel mode — keeping the backend-agnostic four-line-widget shape. Adds a cell-mode regression test asserting the label is on the centre row and the bottom border is left intact.100% coverage;
go vetclean; cross-compilesjs/wasm+linux/arm64. No golden tests in the repo; the affected consumers (tui-demo,wui-demo,wui-wasm) get a more-centred label, matching the documented intent.🤖 Generated with Claude Code