wrap: Avoid trailing whitespace for empty lines

This commit is contained in:
Anatoli Babenia 2022-10-03 18:53:26 +03:00 committed by Dan Buch
parent 9166808eb5
commit a6f5ca69f4
Signed by: meatballhat
GPG Key ID: A12F782281063434

View File

@ -476,7 +476,9 @@ func wrap(input string, offset int, wrapAt int) string {
for i, line := range lines {
if i != 0 {
sb.WriteString(padding)
if len(line) > 0 {
sb.WriteString(padding)
}
}
sb.WriteString(wrapLine(line, offset, wrapAt, padding))