Some progress on making sure splitting and joining text properties updates the start/end status of the props accordingly.
What does not work is undoing the effects of a join, which add an extra textprop spanning the entire line to the unjoined lines. Would appreciate any pointers on how to fix that.
The new code calls STRLEN() a few more times than the old, but does fewer heap allocations per join. I hope this is fine, otherwise there are a few calls to get_text_props that can be done manually as we already know textlen.
Fixes #5683
https://github.com/vim/vim/pull/5839
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
@axelf4 pushed 2 commits.
—
You are receiving this because you are subscribed to this thread.
Turns out the problem with undo was not specific to this change: One can trivially cause an internal error by creating a three-line text property, deleting the middle line and undoing that change, then deleting the line below. This because the undo readds the deleted text property, and then add_text_props_for_append() does it again. Only one will be set to end by adjust_text_props_for_delete() when the line below is deleted.
I can think of two ways to fix this:
Option 2 would require much work to make intuitive for all cases, which is why I prefer 1. From what I could see undo stores the entire lines, so you'd have to compute common prefix/suffix of the first/last undo:ed lines and the old lines, copy props over and resize for the insertion?
Any thoughts on this?