wrap: Avoid trailing whitespace for empty lines

This commit is contained in:
Anatoli Babenia 2022-10-03 18:53:26 +03:00 committed by GitHub
parent 6491ddec12
commit 3f7774aaa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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))