Border offset is wrong when using colorful border or text #332
-
For some reason when I edit the color of a style and add a border, border lines seem to be misaligned. At first I looked at #55 for solution. Here is the code: func main() {
t := lipgloss.JoinVertical(lipgloss.Left,
lipgloss.NewStyle().Border(lipgloss.ThickBorder()).BorderForeground(lipgloss.Color("9")).Render("Hello, world!"),
lipgloss.NewStyle().Border(lipgloss.ThickBorder()).Foreground(lipgloss.Color("2")).Render("Hello, world!"),
lipgloss.NewStyle().Border(lipgloss.ThickBorder()).Render("Hello, world!"),
lipgloss.NewStyle().Border(lipgloss.ThickBorder()).Render("Hello, world!"),
)
t = lipgloss.JoinHorizontal(lipgloss.Top, t, t, t)
fmt.Println(t)
//root.Execute()
} and this is how it looks in alacritty: For some reason emptyspace is added before the border when it or the text inside contains color |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I've figured out by debug that the issue was in ansi.StringWidth function. All you need to do is to downgrade: replace github.com/charmbracelet/x/ansi v0.1.3 => github.com/charmbracelet/x/ansi v0.1.2 |
Beta Was this translation helpful? Give feedback.
-
This was fixed by charmbracelet/x#125 for |
Beta Was this translation helpful? Give feedback.
I've figured out by debug that the issue was in ansi.StringWidth function.
Going to the library github, I've found people who found a way to fix it.
charmbracelet/x#123
All you need to do is to downgrade:
which results in expected output: