We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug Styling seems to get "stuck" for wrapped lines in viewport. This gets corrected every time I resize the window.
Note that whatever happens, the first and last lines work as intended.
As a little extra: I tried what happens with HighPerformanceRendering set to true, but nothing seems to get rendered.
HighPerformanceRendering
true
Setup Please complete the following information along with version numbers, if applicable.
To Reproduce Steps to reproduce the behavior:
Source Code Relevant code parts (cut some logic out of it which doesn't change styling/rendering):
func (li *LogInspector) Update(msg tea.Msg) (*LogInspector, tea.Cmd) { // logic to move cursor with keys } func (li *LogInspector) View() string { // note: same result without applying a width style here return lipgloss.NewStyle().Width(li.width).Render(li.viewport.View()) } func (li *LogInspector) updateViewport() { var sb strings.Builder for i := range li.logs { sb.WriteString(li.renderLog(i)) } li.viewport.SetContent(sb.String()) } func (li *LogInspector) renderLog(idx int) string { logLine := li.logs[idx] if idx == li.cursor { logLine = highlightStyle.Render(logLine) } return logLine + "\n" }
Expected behavior Styling to change.
Screenshots initially correct:
after moving the cursor one down:
after resizing my window:
Additional context N/A
The text was updated successfully, but these errors were encountered:
Annoyingly I found a fix right after posting this:
If I modify my render func
From this:
func (li *LogInspector) renderLog(idx int) string { logLine := li.logs[idx] if idx == li.cursor { logLine = highlightStyle.Render(logLine) } return logLine + "\n" }
To this
func (li *LogInspector) renderLog(idx int) string { logLine := li.logs[idx] logLine = lipgloss.NewStyle().Width(li.width).Render(logLine) if idx == li.cursor { logLine = highlightStyle.Render(logLine) } return logLine + "\n" }
Highighting now works as expected
Adding the highlight first though produces the same issue as originally described
func (li *LogInspector) renderLog(idx int) string { logLine := li.logs[idx] if idx == li.cursor { logLine = highlightStyle.Render(logLine) } logLine = lipgloss.NewStyle().Width(li.width).Render(logLine) return logLine + "\n" }
Sorry, something went wrong.
No branches or pull requests
Describe the bug
Styling seems to get "stuck" for wrapped lines in viewport. This gets corrected every time I resize the window.
Note that whatever happens, the first and last lines work as intended.
As a little extra: I tried what happens with
HighPerformanceRendering
set totrue
, but nothing seems to get rendered.Setup
Please complete the following information along with version numbers, if applicable.
To Reproduce
Steps to reproduce the behavior:
Source Code
Relevant code parts (cut some logic out of it which doesn't change styling/rendering):
Expected behavior
Styling to change.
Screenshots
initially correct:
after moving the cursor one down:
after resizing my window:
Additional context
N/A
The text was updated successfully, but these errors were encountered: