Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not inserting additional newlines when there is leading whitespace in a multiline string. #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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