Closed benmurden closed 4 years ago
potential dupe of #55
While it seems that way on the surface, I think this is a subtle bug, because the bar is being shrunk to fit the terminal width, but still wraps. Looks like the final size needs to be one or two characters shorter.
Can you please check master branch? Should be fixed.
@vbauerster Looks good over here with the master branch. Thanks so much for your time and effort on this.
Thank you for reporting as well. I'll bump version soon.
Running the IO example given here https://github.com/vbauerster/mpb/blob/master/_examples/io/main.go with some modifications to prepend a long name, I have reproduced an issue I'm having where bars get duplicated once they reach the edge of the terminal window.
Actual code
```golang package main import ( "crypto/rand" "io" "io/ioutil" "time" "github.com/vbauerster/mpb/v5" "github.com/vbauerster/mpb/v5/decor" ) func main() { var total int64 = 1024 * 1024 * 1024 reader := io.LimitReader(rand.Reader, total) p := mpb.New( mpb.WithWidth(60), mpb.WithRefreshRate(180*time.Millisecond), ) bar := p.AddBar(total, mpb.BarStyle("[=>-|"), mpb.PrependDecorators( decor.Name("This is a really long name. I'm sorry it's so long but that's just the way it goes sometimes. "), decor.CountersKibiByte("% .2f / % .2f"), decor.Percentage(decor.WCSyncSpace), ), mpb.AppendDecorators( decor.EwmaETA(decor.ET_STYLE_GO, 90), decor.Name(" ] "), decor.EwmaSpeed(decor.UnitKiB, "% .2f", 60), ), ) // create proxy reader proxyReader := bar.ProxyReader(reader) defer proxyReader.Close() // copy from proxyReader, ignoring errors io.Copy(ioutil.Discard, proxyReader) p.Wait() } ```The bar is clearly flexing to fill available space, but is still one character too long, it seems. Shorter names do not produce this issue.
OS: Windows 10