Closed SamVerschueren closed 7 years ago
This PR fixes the jumpy spaces in log-update. Let me explain what's going on.
log-update
Suppose we have a input string like this
'123456789\n '
The string is cut into separate lines
['123456789', ' ']
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.
['12345\n6789', ...]
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.
['12345\n6789', ' ']
I fixed this by bailing out early.
Good detective work!
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.