Codebase list golang-github-vbauerster-mpb / b5c2709
return if width < brackets Vladimir Bauer 6 years ago
2 changed file(s) with 8 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
100100 func (s *barFiller) Fill(w io.Writer, reqWidth int, stat decor.Statistics) {
101101 width := internal.CalcWidthForBarFiller(reqWidth, stat.AvailableWidth)
102102
103 // don't count rLeft and rRight as progress
104 brackets := s.rwidth[rLeft] + s.rwidth[rRight]
105 width -= brackets
106 if width < brackets {
103 if brackets := s.rwidth[rLeft] + s.rwidth[rRight]; width < brackets {
107104 return
105 } else {
106 // don't count brackets as progress
107 width -= brackets
108108 }
109109 w.Write(s.format[rLeft])
110110 defer w.Write(s.format[rRight])
6363 current: 20,
6464 barWidth: 80,
6565 trimSpace: true,
66 want: "",
66 want: "[]",
6767 },
6868 },
6969 3: {
8080 current: 20,
8181 barWidth: 80,
8282 trimSpace: true,
83 want: "",
83 want: "[-]",
8484 },
8585 },
8686 4: {
8989 total: 60,
9090 current: 20,
9191 barWidth: 80,
92 want: " ",
92 want: " [] ",
9393 },
9494 {
9595 name: "t,c,bw{60,20,80}trim",
106106 total: 60,
107107 current: 20,
108108 barWidth: 80,
109 want: " ",
109 want: " [-] ",
110110 },
111111 {
112112 name: "t,c,bw{60,20,80}trim",