-
Notifications
You must be signed in to change notification settings - Fork 270
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
viewport: wrapped lines keep style until resized #681
Comments
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"
} |
It looks like in the original example you're styling the text before wrapping it. I would expect that to cause some issues with the highlighted style not reaching the right rows. @bevicted do you think this is a viewport bug or are you satisfied with your fix? If it's a bug, it would be really helpful to get a minimal reproducible example from you so we can try and debug on our end :) |
Hey @bashbunni My main issue here is when I create the viewport, I set the dimensions via Now I set every width directly and in addition carry a I guess my problem is twofold:
I would honestly prefer if auto line wrapping would be just dropped as it's literally one line to do with lipgloss, and would be a lot easier on viewport's code, however I would expect a note on |
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: