Skip to content

Conversation

@korexus
Copy link

@korexus korexus commented Nov 20, 2024

Fixes #27

When cut is false and the text to wrap contains newlines, the split slurps up whitespace following those newlines. This was stopping the newline character being removed (as it was not at the end of the string) and caused an additional newline to be added.

Also, the whitespace that should have been at the start of the next line had no effect, as it ended up on the additional line that was created.

Checking for trailing whitespace following a newline, moving it to the start of the next line, and removing the newline character fixes the test case mentioned on the issue.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrapping multiline text

1 participant