1
0
mirror of https://github.com/mum4k/termdash.git synced 2025-04-25 13:48:50 +08:00

Replacing strings.Builder with bytes.Buffer.

For backward compatibility.
This commit is contained in:
Jakub Sobon 2018-05-08 19:01:07 +01:00
parent ea375744a7
commit 1bb3a422fc
No known key found for this signature in database
GPG Key ID: F2451A77FB05D3B7

View File

@ -16,10 +16,10 @@
package gauge
import (
"bytes"
"errors"
"fmt"
"image"
"strings"
"sync"
"unicode/utf8"
@ -172,15 +172,15 @@ func (g *Gauge) progressText() string {
// gaugeText returns full text to be displayed within the gauge, i.e. the
// progress text and the optional label.
func (g *Gauge) gaugeText() string {
var sb strings.Builder
sb.WriteString(g.progressText())
var b bytes.Buffer
b.WriteString(g.progressText())
if g.opts.textLabel != "" {
if sb.Len() > 0 {
sb.WriteString(" ")
if b.Len() > 0 {
b.WriteString(" ")
}
sb.WriteString(fmt.Sprintf("(%s)", g.opts.textLabel))
b.WriteString(fmt.Sprintf("(%s)", g.opts.textLabel))
}
return sb.String()
return b.String()
}
// drawText draws the text enumerating the progress and the text label.