Question on undo: Remove a finishUndo() after a recordUndo() ?

Jean-Marc Lasgouttes lasgouttes at lyx.org
Sat Feb 1 19:41:12 UTC 2020


Le 01/02/2020 à 18:39, Scott Kostyshak a écrit :
> What would the consequences be of the attached patch?
> 
>  From what I understand, finishUndo() is meant for when there have been
> som undos of type INSERT or DELETE recorded, but PARAGRAPH_MOVE_DOWN
> itself does not record any INSERTs or DELETEs. What would happen if
> the finishUndo() is removed?
> 
> Is the cur.finishUndo() here meant for the case where a user is typing
> and then executes pargraph-move-down and then continues typing? But
> shouldn't a cur.recordUndo() end a sequence of INSERT type undos anyway?

I think the patch is correct. finishUndo is only useful after a 
recordUndo of type INSERT or DELETE. One place where we use it is when 
moving the cursor around. Then we do not record any und, but we do not 
want the next inserted characters to be lumped with the ones which were 
inserted before the cursor movement.

Actually, I suspect that finishUndo could be removed and replaced with a 
test that the cursor is still at the same position. But I am not 100% 
sure that it would work.

JMarc


More information about the lyx-devel mailing list