From 4f0d448967dbff9047863235ef3a4bf01a8174e2 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Fri, 3 Sep 2021 09:56:28 -0400 Subject: [PATCH] Force-wrap strings that run wider than the width --- style.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/style.go b/style.go index 3ef8e3f5..5743f259 100644 --- a/style.go +++ b/style.go @@ -6,6 +6,7 @@ import ( "github.com/muesli/reflow/truncate" "github.com/muesli/reflow/wordwrap" + "github.com/muesli/reflow/wrap" "github.com/muesli/termenv" ) @@ -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