From 255f75614baec56784db394bb831cd89cfcab625 Mon Sep 17 00:00:00 2001 From: zc Date: Thu, 11 Mar 2021 21:28:05 +0800 Subject: [PATCH] fixed duplicate rendering of extra empty lines --- progressbar.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/progressbar.go b/progressbar.go index fc4053d..cd7704e 100644 --- a/progressbar.go +++ b/progressbar.go @@ -764,11 +764,10 @@ func clearProgressBar(c config, s state) error { // write the "clear current line" ANSI escape sequence return writeString(c, "\033[2K\r") } - // fill the current line with enough spaces + // fill the empty content // to overwrite the progress bar and jump // back to the beginning of the line - str := fmt.Sprintf("\r%s\r", strings.Repeat(" ", s.maxLineWidth)) - return writeString(c, str) + return writeString(c, "\r") } func writeString(c config, str string) error {