refactoring: bar_filler_spinner: use go-runewidth
Vladimir Bauer
5 years ago
| 2 | 2 | import ( |
| 3 | 3 | "io" |
| 4 | 4 | "strings" |
| 5 | "unicode/utf8" | |
| 6 | 5 | |
| 6 | "github.com/mattn/go-runewidth" | |
| 7 | 7 | "github.com/vbauerster/mpb/v5/decor" |
| 8 | 8 | "github.com/vbauerster/mpb/v5/internal" |
| 9 | 9 | ) |
| 43 | 43 | width := internal.WidthForBarFiller(reqWidth, stat.AvailableWidth) |
| 44 | 44 | |
| 45 | 45 | frame := s.frames[s.count%uint(len(s.frames))] |
| 46 | frameWidth := utf8.RuneCountInString(frame) | |
| 46 | frameWidth := runewidth.StringWidth(frame) | |
| 47 | 47 | |
| 48 | 48 | if width < frameWidth { |
| 49 | 49 | return |