Skip to content

Bug: Wrapping can fail in panels because effectiveWrap can be greater than panel width #628

Description

@ccubed

I discovered this while adding my AddBlock into the Panels system. Take the following example:

p := makePanel("x", "X", 20, borderFull, []PanelRow{
		{
			ShortLabel: "A:",
			FullLabel:  "Alpha: ",
			Value:      "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since 1966, when designers at Letraset and James Mosley, the librarian at St Bride Printing Library in London, took a 1914 Cicero translation and scrambled it to make dummy text for Letraset's Body Type sheets.",
			WrapWidth:  60,
		},
	})

This will produce output that looks like:

┌─ X ──────────────┐
│ A: Lorem Ipsum is simply dummy text of the printing and │
│    typesetting industry. Lorem Ipsum has been the industry's│
│    standard dummy text ever since 1966, when designers at│
│    Letraset and James Mosley, the librarian at St Bride│
│    Printing Library in London, took a 1914 Cicero translation│
│    and scrambled it to make dummy text for Letraset's Body│
│    Type sheets.  │
└──────────────────┘

The reason is that the panels system never checks to see if effectiveWrap fits within the panel width.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions