silly optimization

This commit is contained in:
Anand Babu (AB) Periasamy
2015-06-03 15:17:51 -07:00
parent 13d206a38c
commit 1f963c2feb
+2 -1
View File
@@ -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