progressbar icon indicating copy to clipboard operation
progressbar copied to clipboard

[Bug] Console output after progress bar doesn't start with new line

Open mih-kopylov opened this issue 2 years ago • 0 comments

Affected version

3.9.0

Steps To Reproduce

Create the following code example

package main

import (
	"fmt"
	"github.com/schollz/progressbar/v3"
	"time"
)

func main() {
	count := 10
	progressBar := progressbar.NewOptions(
		count,
		progressbar.OptionFullWidth(),
		progressbar.OptionSetRenderBlankState(true),
		progressbar.OptionShowCount(),
		progressbar.OptionSetVisibility(true),
		progressbar.OptionSetPredictTime(false),
		progressbar.OptionClearOnFinish(),
	)

	for i := 0; i < count; i++ {
		time.Sleep(time.Millisecond * 100)
		_ = progressBar.Add(1)
	}

	fmt.Println("hello")
}

Run

go get github.com/schollz/progressbar/[email protected]

Then run the example.

The result is

> go run .
hello

Then run

go get github.com/schollz/progressbar/[email protected]

And run the example again.

The result is

> go run .
                                                                                                                                           hello

Notice number of spaces before the hello word.

See the playground https://go.dev/play/p/Tpiz7wA-E2g?v=goprev

mih-kopylov avatar Aug 03 '22 21:08 mih-kopylov