mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #429] Panic on TextView.reindexBuffer #314
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#314
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 @pengux on GitHub (Apr 11, 2020).
Original GitHub issue: https://github.com/rivo/tview/issues/429
Not sure what's the problem is but it should probably do a bound check and return an error instead of panic if it is out of bound. The stack trace:
@rivo commented on GitHub (Apr 14, 2020):
To determine the best solution to this, it would be helpful to be able to reproduce this panic. Can you please post a small program that will cause this panic?
@db-tech commented on GitHub (Apr 23, 2020):
I've got the same error. For me the main problem was that i wrongly sliced a string.
It took me a while but I could reproduce it:
Seems a problem with those special character, the slicing and the wrapping.
I've no time at the moment but could take a look at it next week.
@rivo commented on GitHub (May 7, 2020):
Interesting. This appears to be a problem of converting strings to rune slices and back. If the original string contains invalid code points, the resulting string may be longer. See here:
https://play.golang.org/p/0PrzUP4_4cr
And that conversion is what happens in
go-runewidth'sTruncate()function which I'm using. I will submit a pull request over there.@rivo commented on GitHub (Jan 17, 2021):
My long-running PR to
go-runewidthwas just merged and the latest version does not produce a panic anymore with the example posted above. Unless you find that this is still a problem, I will soon close this issue. If there is still a panic, please post a small code snippet to reproduce.(If you find that this issue is already closed, please open a new issue and reference this one.)
@pengux commented on GitHub (Jan 17, 2021):
I haven't tried out your PR but let's close this issue and I can create a new one if needed.