Skip to content

Commit 6a718fa

Browse files
authored
Fixup line wrapper short write bug
1 parent acf41e6 commit 6a718fa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

encoding.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ func (w *lineWrapper) Write(b []byte) (int, error) {
129129
if err != nil {
130130
return written, err
131131
}
132+
// If the written `\n` was part of the input bytes slice, then account for it.
133+
if lf {
134+
written++
135+
}
132136
w.cr = false
133137
}
134138

0 commit comments

Comments
 (0)