better implementation for wrapWords

This commit is contained in:
Araq 2018-11-08 16:00:49 +01:00 • committed by Andreas Rumpf
commit 56f76c5b08
2 changed files with 80 additions and 58 deletions

View file

@ -1211,7 +1211,8 @@ proc wordWrap*(s: string, maxLineWidth = 80,
splitLongWords = true,
seps: set[char] = Whitespace,
newLine = "\n"): string {.
noSideEffect, rtl, extern: "nsuWordWrap".} =
noSideEffect, rtl, extern: "nsuWordWrap",
deprecated: "use wrapWords in std/wordwrap instead".} =
## Word wraps `s`.
result = newStringOfCap(s.len + s.len shr 6)
var spaceLeft = maxLineWidth