Skip to content

Hyphens can cause wordwrap to exceed the limit #66

@JaredReisinger

Description

@JaredReisinger

When wordwrap.Write() encounters a hyphen, it immediately adds the existing space, word, and hyphen, without first checking to see if this would exceed the limit. This can cause the hyphen to extend beyond the limit.

Example: wordwrap.String("foo foo-foobar", 7) should return

1234567|  <-- limit
foo    |
foo-   |
foobar |

but actually returns:

1234567|  <-- limit
foo foo|- <-- hyphen beyond limit
foobar |

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions