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

Scott Kostyshak skostysh at lyx.org
Sun Feb 2 21:14:09 UTC 2020


On Sat, Feb 01, 2020 at 08:41:12PM +0100, Jean-Marc Lasgouttes wrote:
> 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.

Thanks for taking a look. It's in at 05f24940.

> 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.

Makes sense. Cursor movement is a good example.

Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20200202/d7d688ad/attachment.asc>


More information about the lyx-devel mailing list