bubbles icon indicating copy to clipboard operation
bubbles copied to clipboard

Viewport: truncation and wrapping options

Open meowgorithm opened this issue 3 years ago • 3 comments

It would be nice if the viewport provided some options to automatically wrap and truncate text to keep layouts from breaking, rather than leaving this as an exercise for the user.

The most likely solution here is to take advantage of reflow.

meowgorithm avatar Jul 09 '21 13:07 meowgorithm

Is this the reason why SetcContent with a very large text will make the viewport expand in height? I was under the assumption that I might have done something wrong, so I'm still looking into why the viewport won't obey the height I set. I thought that a large content will make the viewport scroll vertically.

mrusme avatar Mar 20 '22 00:03 mrusme

@mrusme iirc, yes. you'll want to wrap your text with something like:

str := lipgloss.NewStyle().Width(width).Render(content)
model.SetContent(str)

meowgorithm avatar Mar 20 '22 18:03 meowgorithm