From 3e6b9bf007862f9acf97b7cdc2dc2c8f6683f110 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Mon, 15 Mar 2021 12:13:17 -0700 Subject: [PATCH] revert 255f75614baec56784db394bb831cd89cfcab625 because it does not work when the subsequent lines are shorter --- progressbar.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/progressbar.go b/progressbar.go index cd7704e..e137f35 100644 --- a/progressbar.go +++ b/progressbar.go @@ -767,7 +767,10 @@ func clearProgressBar(c config, s state) error { // fill the empty content // to overwrite the progress bar and jump // back to the beginning of the line - return writeString(c, "\r") + str := fmt.Sprintf("\r%s\r", strings.Repeat(" ", s.maxLineWidth)) + return writeString(c, str) + // the following does not show correctly if the previous line is longer than subsequent line + // return writeString(c, "\r") } func writeString(c config, str string) error {