Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Width truncation broke lipgloss border rendering #123

Closed
shaunco opened this issue Jul 12, 2024 · 1 comment · Fixed by #125
Closed

Width truncation broke lipgloss border rendering #123

shaunco opened this issue Jul 12, 2024 · 1 comment · Fixed by #125

Comments

@shaunco
Copy link

shaunco commented Jul 12, 2024

Describe the bug
The 3099677 or fe84162 change seems to have made full dimension rendering of lipgloss border box content produce wider than allowed lines, which causes 1 character to wrap onto the next line for each line, which breaks up the border and content with new empty lines between each row.

	viewBox = lipgloss.NewStyle().
			Border(lipgloss.RoundedBorder()).
			BorderForeground(green).
			Padding(1).
			Margin(1)

	width := consoleWidth - viewBox.GetHorizontalFrameSize()
	height := consoleHeight - viewBox.GetVerticalFrameSize()
	return viewBox.
		Height(height).
		MaxHeight(consoleHeight).
		Width(width).
		MaxWidth(consoleWidth).
		Margin(0).
		Render("test content")

With lipgloss 0.11.0, which pulled in x/ansi v0.1.2, this works great and draws a nice border around everything. When lipgloss 0.12.0 moved to x/ansi v0.1.3, this broke and started outputting wider than allowed lines, which causes unexpected wrap, which causes blank lines between each row. The issue persists if I go back to lipgloss 0.11.0, but still using x/ansi 0.1.3. The issue goes away if I go back to x/ansi 0.1.2.

@luevano
Copy link

luevano commented Jul 12, 2024

Already reported it too on #122 , I guess my title name is not searchable. I'll update my title as well.

aymanbagabas added a commit that referenced this issue Jul 12, 2024
We need to reset the grapheme state after encountering a non-printable
character or when we're not using uniseg for string width (ASCII
printables have a width of 1 cell).

Fixes: #122
Fixes: #123
Fixes: charmbracelet/lipgloss#332
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants