reflow
reflow copied to clipboard
Coloring issue when used in association with lipgloss.JoinHorizontal
When the wrapping is done on the right of the terminal, the start of the line is highlighted (aapt in the screenshot).
Here is the method setting the preview
func (c *List) RefreshPreview() {
previewWidth := c.viewport.Width - 2 // padding
previewContent := wrap.String(wordwrap.String(c.previewContent, previewWidth), previewWidth)
c.viewport.SetContent(previewContent)
}
and here is the view method:
func (c List) View() string {
if c.actions.Focused() {
return c.actions.View()
}
if c.ShowPreview {
var separatorChars = make([]string, c.viewport.Height)
for i := 0; i < c.viewport.Height; i++ {
separatorChars[i] = "│"
}
separator := strings.Join(separatorChars, "\n")
view := lipgloss.JoinHorizontal(lipgloss.Top, c.filter.View(), separator, c.viewport.View())
return lipgloss.JoinVertical(lipgloss.Top, c.header.View(), view, c.footer.View())
}
return lipgloss.JoinVertical(lipgloss.Left, c.header.View(), c.filter.View(), c.footer.View())
}
An additional screenshot with even more occurence of the issue: