mirror of
https://github.com/nim-lang/Nim.git
synced 2026-09-17 18:44:53 +00:00
wrapWords(splitLongWords = true) dropped the separator before a word it had to split, fusing it with the word before it. Flush lastSep first, the same as the branch that handles a word which fits. Updates twordwrap's longlongwordRes fixture, which was pinned against the old behavior at three points where a source line break normalizes to a synthetic space.
This commit is contained in:
committed by
GitHub
parent
87511babb5
commit
50778f2946
@@ -53,6 +53,8 @@ proc wrapWords*(s: string, maxLineWidth = 80,
|
||||
let wlen = olen(s, i, j)
|
||||
if wlen > spaceLeft:
|
||||
if splitLongWords and wlen > maxLineWidth:
|
||||
if lastSep.len > 0 and spaceLeft > 0:
|
||||
result.add(lastSep)
|
||||
var k = 0
|
||||
while k < j - i:
|
||||
if spaceLeft <= 0:
|
||||
|
||||
Reference in New Issue
Block a user