diff --git a/go.mod b/go.mod index 5b4599ef..0f0b452a 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ retract v0.7.0 // v0.7.0 introduces a bug that causes some apps to freeze. go 1.18 require ( - github.com/charmbracelet/x/exp/term v0.0.0-20240328150354-ab9afc214dfd + github.com/charmbracelet/x/exp/term v0.0.0-20240328180709-6b796dc78d2d github.com/muesli/termenv v0.15.2 github.com/rivo/uniseg v0.4.7 ) diff --git a/go.sum b/go.sum index a313ebc7..45376a72 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= -github.com/charmbracelet/x/exp/term v0.0.0-20240328150354-ab9afc214dfd h1:HqBjkSFXXfW4IgX3TMKipWoPEN08T3Pi4SA/3DLss/U= -github.com/charmbracelet/x/exp/term v0.0.0-20240328150354-ab9afc214dfd/go.mod h1:6GZ13FjIP6eOCqWU4lqgveGnYxQo9c3qBzHPeFu4HBE= +github.com/charmbracelet/x/exp/term v0.0.0-20240328180709-6b796dc78d2d h1:OTGSTcRfFHZ8QOVhdHUW0Qwi2UBsH7QQnJ++uwtbwFE= +github.com/charmbracelet/x/exp/term v0.0.0-20240328180709-6b796dc78d2d/go.mod h1:6GZ13FjIP6eOCqWU4lqgveGnYxQo9c3qBzHPeFu4HBE= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= diff --git a/style.go b/style.go index 43d1144a..e79aca0c 100644 --- a/style.go +++ b/style.go @@ -308,8 +308,7 @@ func (s Style) Render(strs ...string) string { // Word wrap if !inline && width > 0 { wrapAt := width - leftPadding - rightPadding - str = ansi.Wordwrap(str, wrapAt, "") - str = ansi.Wrap(str, wrapAt, false) // force-wrap long strings + str = ansi.SmartWrap(str, wrapAt, "") } // Render core text