diff --git a/bar.go b/bar.go index e094e78..54256a1 100644 --- a/bar.go +++ b/bar.go @@ -259,15 +259,15 @@ op(s) case cmd := <-b.cmdValue: switch { - case cmd&cmdId != 0: + case (cmd & cmdId) != 0: b.cmdValue <- s.id - case cmd&cmdCurrent != 0: + case (cmd & cmdCurrent) != 0: b.cmdValue <- int(s.current) - case cmd&cmdPLen != 0: + case (cmd & cmdPLen) != 0: b.cmdValue <- len(s.pDecorators) - case cmd&cmdALen != 0: + case (cmd & cmdALen) != 0: b.cmdValue <- len(s.aDecorators) - case cmd&cmdCompleted != 0: + case (cmd & cmdCompleted) != 0: var v int if s.toComplete { v = 1 diff --git a/decor/decorator.go b/decor/decorator.go index 344d4d0..b454404 100644 --- a/decor/decorator.go +++ b/decor/decorator.go @@ -98,13 +98,13 @@ // FormatMsg formats final message according to WC.W and WC.C. // Should be called by any Decorator implementation. func (wc WC) FormatMsg(msg string, widthAccumulator chan<- int, widthDistributor <-chan int) string { - if wc.C&DSyncWidth != 0 { + if (wc.C & DSyncWidth) != 0 { widthAccumulator <- utf8.RuneCountInString(msg) max := <-widthDistributor if max == 0 { max = wc.W } - if wc.C&DextraSpace != 0 { + if (wc.C & DextraSpace) != 0 { max++ } return fmt.Sprintf(fmt.Sprintf(wc.format, max), msg) @@ -115,7 +115,7 @@ // BuildFormat builds initial format according to WC.C func (wc *WC) BuildFormat() { wc.format = "%%" - if wc.C&DidentRight != 0 { + if (wc.C & DidentRight) != 0 { wc.format += "-" } wc.format += "%ds"