Skip to content

Extra newlines when combining unconditional and standard word wrapping #43

Open
@meowgorithm

Description

@meowgorithm

When combining word-wrapping with unconditional wrapping as described in the README, extra linebreaks can sometimes be found in the output.

For example:

const str = "the quick brown foxxxxxxxxxxxxxxxx jumped over the lazy dog."
const limit = 16
wrapped := wrap.String(wordwrap.String(str, limit), limit)
fmt.Println(wrapped)

Outputs:

the quick brown
foxxxxxxxxxxxxxx
xx
jumped over the
lazy dog.

However, I'd expect it to be:

the quick brown
foxxxxxxxxxxxxxx
xx jumped over 
the lazy dog.

Playground Example

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions