Description
With custom corner glyphs wider than the vertical glyph (e.g. emoji, "++"), a Top/Bottom title that dictates the box width renders a titled bar wider than the rest of the box.
Reproduction
b := box.NewBox().TopLeft("🌸").TopRight("🌸").BottomLeft("🌸").BottomRight("🌸").TitlePosition(box.Top)
out, _ := b.Render("A moderately long title here", "ab")
Actual (visible widths 34/32/32):
🌸 A moderately long title here 🌸
│ab │
🌸────────────────────────────🌸
Expected: all lines equal width. 36 failing combinations found in a corner×vertical×horizontal sweep; also reproduces with ASCII "++" corners and Bottom position.
Root cause
computeLayout enforces a minimum inner width of titleWidth+2, but the titled bar's span between its corners is innerWidth + 2*verticalWidth − leftCornerW − rightCornerW. When corners are wider than verticals, buildTitledBar clamps and overflows by 2*(cornerW − verticalW).
Fix prepared locally; will land referencing this issue.
Description
With custom corner glyphs wider than the vertical glyph (e.g. emoji,
"++"), a Top/Bottom title that dictates the box width renders a titled bar wider than the rest of the box.Reproduction
Actual (visible widths 34/32/32):
Expected: all lines equal width. 36 failing combinations found in a corner×vertical×horizontal sweep; also reproduces with ASCII
"++"corners and Bottom position.Root cause
computeLayoutenforces a minimum inner width oftitleWidth+2, but the titled bar's span between its corners isinnerWidth + 2*verticalWidth − leftCornerW − rightCornerW. When corners are wider than verticals,buildTitledBarclamps and overflows by2*(cornerW − verticalW).Fix prepared locally; will land referencing this issue.