diff --git a/panel.go b/panel.go index 6bb726f..e003de2 100644 --- a/panel.go +++ b/panel.go @@ -54,7 +54,6 @@ type Labeler interface { func NewImage(src string, face font.Face, noWindowAccessBar bool) *Panel { ml := MaxLine(src) - ml = strings.ReplaceAll(ml, "\t", " ") // replace tab to whitespace ml = ml + " " width := CalcWidth(font.MeasureString(face, " ").Ceil() * len(ml)) diff --git a/util.go b/util.go index b029f93..20b9971 100644 --- a/util.go +++ b/util.go @@ -30,6 +30,8 @@ func ReadString(r io.Reader, face font.Face) (string, error) { } func MaxLine(s string) string { + s = strings.ReplaceAll(s, "\t", " ") // replace tab to whitespace + var ret string for _, line := range strings.Split(s, "\n") { if utf8.RuneCountInString(ret) < utf8.RuneCountInString(line) {