Skip to content

Commit

Permalink
Force-wrap strings that run wider than the width
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed Sep 3, 2021
1 parent 7f051d0 commit 4f0d448
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion style.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/muesli/reflow/truncate"
"github.com/muesli/reflow/wordwrap"
"github.com/muesli/reflow/wrap"
"github.com/muesli/termenv"
)

Expand Down Expand Up @@ -263,7 +264,9 @@ func (s Style) Render(str string) string {

// Word wrap
if !inline && width > 0 {
str = wordwrap.String(str, width-leftPadding-rightPadding)
wrapAt := width - leftPadding - rightPadding
str = wordwrap.String(str, wrapAt)
str = wrap.String(str, wrapAt) // force-wrap long strings
}

// Render core text
Expand Down

0 comments on commit 4f0d448

Please sign in to comment.