lipgloss icon indicating copy to clipboard operation
lipgloss copied to clipboard

Extra newlines when using JoinVertical - Regression between v10 and v11

Open kalensk opened this issue 8 months ago • 0 comments

Describe the bug Extra newlines are added between every line appearing as if the text was double spaced when using lipgloss.JoinVertical(). It only appears to occur on subsequent renders/calls. This is a v11 regression as the issue does not occur appear v10.

Possibly related to https://github.com/charmbracelet/lipgloss/issues/199

Setup Please complete the following information along with version numbers, if applicable.

  • OS [Ubuntu 22.04]
  • Shell [Bash]
  • Terminal Emulator: [None]
  • Terminal Multiplexer [None]
  • Locale [en_US.UTF-8]

To Reproduce Steps to reproduce the behavior:

top := `I am top text
there is a lot in my header to show.`

middle := "I am in the middle with some bullets
- one
- two
- three"

bottom := "bottom text
with a fotter"

lipgloss.JoinVertical(lipgloss.Left, top, middle, bottom)

In v10 this example renders as expected, but in v11 it renders with double spacing which is unexpected and a bug.

The issue could be in github.com/charmbracelet/x/ansi with the switch from ansi.PrintableRuneWidth() to ansi.StringWidth()

Note the issue appears to only occurs on subsequent calls/renders, so I wonder if its a copy() related issue?

kalensk avatar Jun 11 '24 23:06 kalensk