From 1f963c2feb1cd8709cdacf6912e431afb8a54287 Mon Sep 17 00:00:00 2001 From: "Anand Babu (AB) Periasamy" Date: Wed, 3 Jun 2015 15:17:51 -0700 Subject: [PATCH] silly optimization --- cp-bar.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cp-bar.go b/cp-bar.go index 88f83b33..dbbb06ae 100644 --- a/cp-bar.go +++ b/cp-bar.go @@ -103,12 +103,13 @@ func newCpBar() barSend { bar.SetRefreshRate(time.Millisecond * 10) bar.NotPrint = true bar.ShowSpeed = true + cursorUp := fmt.Sprintf("%c[%dA", 27, 1) bar.Callback = func(s string) { if redraw { console.Bar("\n") } // Clear the caption line - console.Bar("\r" + fmt.Sprintf("%c[%dA", 27, 1) + strings.Repeat(" ", len(s)) + "\r") + console.Bar("\r" + cursorUp + strings.Repeat(" ", len(s)) + "\r") // Print the caption and the progress bar console.Bar(barCaption + "\n" + s) redraw = false