From 7594c51802564209dee8ca4c5ee5c319f2363b46 Mon Sep 17 00:00:00 2001 From: Mengsheng Wu Date: Wed, 9 Jul 2025 11:17:52 +0800 Subject: [PATCH] fix: flickering on powershell --- progressbar.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/progressbar.go b/progressbar.go index 125290a..b8f66da 100644 --- a/progressbar.go +++ b/progressbar.go @@ -10,6 +10,7 @@ import ( "net/http" "os" "regexp" + "runtime" "strings" "sync" "time" @@ -1373,6 +1374,9 @@ 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 + if runtime.GOOS == "windows" { + 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