mirror of
https://github.com/charmbracelet/lipgloss.git
synced 2024-10-05 18:28:00 +03:00
fix: combining both conditional and unconditional wrapping (#275)
* feat: switch to term/ansi for text manipulation Use ANSI aware, wide characters support, uniseg backed term/ansi package to calculate string widths, truncate, and wrap strings. Related: https://github.com/muesli/reflow/pull/71 Fixes: https://github.com/charmbracelet/lipgloss/issues/258 Fixes: https://github.com/charmbracelet/lipgloss/issues/220 * fix: combining both conditional and unconditional wrapping Uses `ansi.SmartWrap` https://github.com/charmbracelet/x/pull/57 Fixes: https://github.com/muesli/reflow/issues/43 * chore: update deps * Update get.go
This commit is contained in:
parent
f6f93348b0
commit
2434fdaf07
2
go.mod
2
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-20240329185201-62a6965a9fad
|
||||
github.com/muesli/termenv v0.15.2
|
||||
github.com/rivo/uniseg v0.4.7
|
||||
)
|
||||
|
4
go.sum
4
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-20240329185201-62a6965a9fad h1:ixybSpyIZys0qK4JF0asuuxdr9fMXHrOQa7/G9eO+nc=
|
||||
github.com/charmbracelet/x/exp/term v0.0.0-20240329185201-62a6965a9fad/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=
|
||||
|
3
style.go
3
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.Wrap(str, wrapAt, "")
|
||||
}
|
||||
|
||||
// Render core text
|
||||
|
Loading…
Reference in New Issue
Block a user