diff --git a/_examples/poplog/main.go b/_examples/poplog/main.go index 74d976d..ad95246 100644 --- a/_examples/poplog/main.go +++ b/_examples/poplog/main.go @@ -64,7 +64,7 @@ func makeLogBar(msg string) mpb.BarFiller { limit := "%%.%ds" - return mpb.BarFillerFunc(func(w io.Writer, width int, st decor.Statistics) { - fmt.Fprintf(w, fmt.Sprintf(limit, width), msg) + return mpb.BarFillerFunc(func(w io.Writer, _ int, st decor.Statistics) { + fmt.Fprintf(w, fmt.Sprintf(limit, st.TermWidth-st.OccupiedWidth), msg) }) } diff --git a/_examples/suppressBar/main.go b/_examples/suppressBar/main.go index 6346f32..2572312 100644 --- a/_examples/suppressBar/main.go +++ b/_examples/suppressBar/main.go @@ -101,7 +101,7 @@ default: } if msg != nil { - limitFmt := fmt.Sprintf("%%.%ds", width) + limitFmt := fmt.Sprintf("%%.%ds", st.TermWidth-st.OccupiedWidth) fmt.Fprintf(w, limitFmt, *msg) nextCh <- struct{}{} } else {