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

Coloring issue when used in association with lipgloss.JoinHorizontal #52

Open
pomdtr opened this issue Jan 27, 2023 · 1 comment
Open

Comments

@pomdtr
Copy link

pomdtr commented Jan 27, 2023

image

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())
}
@pomdtr
Copy link
Author

pomdtr commented Jan 27, 2023

An additional screenshot with even more occurence of the issue:

image

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

No branches or pull requests

1 participant