Skip to content

Top/Bottom title bar overflows the box when corner glyphs are wider than the vertical glyph #69

Description

@Delta456

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions