Codebase list golang-github-vbauerster-mpb / 61c927b
FormatMsg vars refactoring Vladimir Bauer 3 years ago
1 changed file(s) with 7 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
138138 // Should be called by any Decorator implementation.
139139 func (wc *WC) FormatMsg(msg string) string {
140140 pureWidth := runewidth.StringWidth(msg)
141 stripWidth := runewidth.StringWidth(stripansi.Strip(msg))
142 maxCell := wc.W
141 viewWidth := runewidth.StringWidth(stripansi.Strip(msg))
142 max := wc.W
143143 if (wc.C & DSyncWidth) != 0 {
144 cellCount := stripWidth
144 viewWidth := viewWidth
145145 if (wc.C & DextraSpace) != 0 {
146 cellCount++
146 viewWidth++
147147 }
148 wc.wsync <- cellCount
149 maxCell = <-wc.wsync
148 wc.wsync <- viewWidth
149 max = <-wc.wsync
150150 }
151 return wc.fill(msg, maxCell+(pureWidth-stripWidth))
151 return wc.fill(msg, max-viewWidth+pureWidth)
152152 }
153153
154154 // Init initializes width related config.