From 2b86af52d6df804073329faa3e97e6ca63ffd374 Mon Sep 17 00:00:00 2001 From: "Anand Babu (AB) Periasamy" Date: Mon, 15 Jun 2015 02:51:41 -0700 Subject: [PATCH] do not move/delete console output before printing anything --- cp-bar.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cp-bar.go b/cp-bar.go index 39abb38b..774d5d0c 100644 --- a/cp-bar.go +++ b/cp-bar.go @@ -126,9 +126,14 @@ func newCpBar() barSend { cursorUp := fmt.Sprintf("%c[%dA", 27, 1) eraseCurrentLine := fmt.Sprintf("%c[2K\r", 27) cursorDown := fmt.Sprintf("%c[%dB", 27, 1) + firstTime := true bar.Callback = func(s string) { - console.Print(cursorUp) - console.Print(eraseCurrentLine) + if !firstTime { + console.Print(cursorUp) + console.Print(eraseCurrentLine) + } + firstTime = false + console.Bar(barCaption) console.Print(cursorDown)