Codebase list golang-github-vbauerster-mpb / a929990
refactoring WidthForBarFiller Vladimir Bauer 6 years ago
3 changed file(s) with 3 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
9898 }
9999
100100 func (s *barFiller) Fill(w io.Writer, reqWidth int, stat decor.Statistics) {
101 width := internal.CalcWidthForBarFiller(reqWidth, stat.AvailableWidth)
101 width := internal.WidthForBarFiller(reqWidth, stat.AvailableWidth)
102102
103103 if brackets := s.rwidth[rLeft] + s.rwidth[rRight]; width < brackets {
104104 return
4040 }
4141
4242 func (s *spinnerFiller) Fill(w io.Writer, reqWidth int, stat decor.Statistics) {
43 width := internal.CalcWidthForBarFiller(reqWidth, stat.AvailableWidth)
43 width := internal.WidthForBarFiller(reqWidth, stat.AvailableWidth)
4444
4545 frame := s.frames[s.count%uint(len(s.frames))]
4646 frameWidth := utf8.RuneCountInString(frame)
00 package internal
11
2 func CalcWidthForBarFiller(reqWidth, available int) int {
2 func WidthForBarFiller(reqWidth, available int) int {
33 if reqWidth <= 0 || reqWidth >= available {
44 return available
55 }