diff --git a/bar.go b/bar.go index d20524b..032a450 100644 --- a/bar.go +++ b/bar.go @@ -359,8 +359,14 @@ s.fillBar(s.width) barCount := utf8.RuneCount(s.bufB.Bytes()) totalCount := prependCount + barCount + appendCount - if totalCount > termWidth { - s.fillBar(termWidth - prependCount - appendCount) + if spaceCount := 0; totalCount > termWidth { + if !s.trimLeftSpace { + spaceCount++ + } + if !s.trimRightSpace { + spaceCount++ + } + s.fillBar(termWidth - prependCount - appendCount - spaceCount) } return io.MultiReader(s.bufP, s.bufB, s.bufA)