mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 05:45:49 +03:00
[GH-ISSUE #939] Out-of-bounds panic when text wrapping is enabled #687
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#687
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @darkhz on GitHub (Jan 17, 2024).
Original GitHub issue: https://github.com/rivo/tview/issues/939
When text-wrapping is enabled on an empty textview, i.e. set by
(*tview.TextView).SetWrap(true)andScrollToHighlight()is used,an out of bounds panic occurs when a region is highlighted, but the
lineIndexbuffer is empty (textview.go#L1070C21-L1070C21).Maybe check whether the
lineIndexbuffer is empty before getting highlights?@rivo commented on GitHub (Jan 17, 2024):
Can you please provide a small program that reproduces this error?
@darkhz commented on GitHub (Jan 17, 2024):
Here is a small example to illustrate the above issue.
I have also edited the first comment above for clarification.
@rivo commented on GitHub (Jan 18, 2024):
Thank you. The latest commit should fix this. There were two issues here:
Highlightmethod could highlight regions that didn't exist in the text. That is now not possible anymore.Highlightand the next time the text view is drawn. In that case, we have to parse again until all highlighted regions are known. So I added that, too.