Codebase list golang-github-vbauerster-mpb / cbaf9dd
improve readability for future self Vladimir Bauer 7 years ago
2 changed file(s) with 8 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
258258 op(s)
259259 case cmd := <-b.cmdValue:
260260 switch {
261 case cmd&cmdId != 0:
261 case (cmd & cmdId) != 0:
262262 b.cmdValue <- s.id
263 case cmd&cmdCurrent != 0:
263 case (cmd & cmdCurrent) != 0:
264264 b.cmdValue <- int(s.current)
265 case cmd&cmdPLen != 0:
265 case (cmd & cmdPLen) != 0:
266266 b.cmdValue <- len(s.pDecorators)
267 case cmd&cmdALen != 0:
267 case (cmd & cmdALen) != 0:
268268 b.cmdValue <- len(s.aDecorators)
269 case cmd&cmdCompleted != 0:
269 case (cmd & cmdCompleted) != 0:
270270 var v int
271271 if s.toComplete {
272272 v = 1
9797 // FormatMsg formats final message according to WC.W and WC.C.
9898 // Should be called by any Decorator implementation.
9999 func (wc WC) FormatMsg(msg string, widthAccumulator chan<- int, widthDistributor <-chan int) string {
100 if wc.C&DSyncWidth != 0 {
100 if (wc.C & DSyncWidth) != 0 {
101101 widthAccumulator <- utf8.RuneCountInString(msg)
102102 max := <-widthDistributor
103103 if max == 0 {
104104 max = wc.W
105105 }
106 if wc.C&DextraSpace != 0 {
106 if (wc.C & DextraSpace) != 0 {
107107 max++
108108 }
109109 return fmt.Sprintf(fmt.Sprintf(wc.format, max), msg)
114114 // BuildFormat builds initial format according to WC.C
115115 func (wc *WC) BuildFormat() {
116116 wc.format = "%%"
117 if wc.C&DidentRight != 0 {
117 if (wc.C & DidentRight) != 0 {
118118 wc.format += "-"
119119 }
120120 wc.format += "%ds"