Axel Forsman wrote:

> 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:
> 
> 1. Either make undo act as if the text was re-typed, and don't store
> props for undo, 2. or, commit to "same id/type" <=> allowed to unify.
> That is, the undo readded some prop. This was done inside the same
> text prop: Extend it to cover union.
> 
> 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?

I would prefer to have undo also restore the text property.  In case
text properties are manually added it's the only way to have a real
undo.

But it should then also undo the changes in the line above and below, so
that text properties that were adjusted for what was deleted is also
undone.  Thus the number of lines that undo saves must be adjusted also
for changes in text properties.

-- 
Individualists unite!

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202003252124.02PLORJE016000%40masaka.moolenaar.net.

Raspunde prin e-mail lui