From d78cac53910507b45d51fa370d3291c172e902dc Mon Sep 17 00:00:00 2001 From: Florian Boucault Date: Fri, 24 Apr 2020 22:16:45 +0200 Subject: [PATCH] Writer.Flush: properly compute line count for buffers longer than 2 lines --- writer.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/writer.go b/writer.go index d76542a..47b89d5 100644 --- a/writer.go +++ b/writer.go @@ -90,11 +90,11 @@ func (w *Writer) Flush() error { lines++ currentLine.Reset() } else { - currentLine.Write([]byte{b}) - if overFlowHandled && currentLine.Len() > termWidth { + if overFlowHandled && currentLine.Len() >= termWidth { lines++ currentLine.Reset() } + currentLine.Write([]byte{b}) } } w.lineCount = lines @@ -170,4 +170,4 @@ func (n *newline) Write(p []byte) (int, error) { n.writer.mtx.Lock() defer n.writer.mtx.Unlock() return n.writer.buf.Write(p) -} \ No newline at end of file +}