charmbracelet / lipgloss

Style definitions for nice terminal layouts 👄
MIT License
7.65k stars 209 forks source link

Unexpected artifacts from lg.JoinVertical #199

Open NiloCK opened 1 year ago

NiloCK commented 1 year ago

Describe the bug

JoinVertical is adding extra newLines (or otherwise something weird is happening) to the topmost passed text.

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

To Reproduce Steps to reproduce the behavior:

git clone http://github.com/nilock/tuido
cd tuido
go run .
[press ENTER] - opens context preview on the first listed todo item]

This will display the broken text from below.

To see the same text unbroken, replace return lg.JoinVertical(lg.Left, bodyWithPointer, foot) with return bodyWithPointer on line 44 of ./tui/peek.go, and rerun the above instructions.

Source Code http://github.com/nilock/tuido

Expected behavior See screenshots.

Screenshots

Broken text:

image

The same text not joined with the footer:

image

Additional context The broken text is read at runtime from files on disk. The breaking newline behaviour only occurs when rendering .go files - the .md (eg, readme.md) file gets rendered correctly. AFAICT, both are Uni-8. I can't guess why the discrepancy, but this feels like a good clue.

Some other things are happening to this text before the JoinVertical

... Manually removing each of these showed no effect - the described issue still presents.

kalensk commented 3 weeks ago

I am running into something similar https://github.com/charmbracelet/lipgloss/issues/317