Fix space issues at the end of input string #21
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the jumpy spaces in
log-update
. Let me explain what's going on.Suppose we have a input string like this
The string is cut into separate lines
Let's wrap at 5. The first word is split on spaces, which it doesn't have so we can then cut at the 5th character.
The next word (empty space) is now taken being processed. The word is split at a space character, and thus that line now has 2 words.
Because of this line, this word will now end up as 2 spaces, and thus has one space to many.
I fixed this by bailing out early.