Fix faulty undo recording

The recordUndo() call is very wrong, since we may be inserting over a
selection covering several paragraphs (undo itself works at paragraph
granularity).

recordUndoSelection() is the right operation in this case. It is
equivalent to recordUndo() when there is no selection.
This commit is contained in:
Jean-Marc Lasgouttes 2024-07-16 15:43:11 +02:00
parent cca68d0614
commit 82f387dabc

View File

@ -3600,7 +3600,7 @@ bool doInsertInset(Cursor & cur, Text * text,
if (InsetCollapsible * ci = inset->asInsetCollapsible()) if (InsetCollapsible * ci = inset->asInsetCollapsible())
ci->setButtonLabel(); ci->setButtonLabel();
cur.recordUndo(); cur.recordUndoSelection();
if (cmd.action() == LFUN_ARGUMENT_INSERT) { if (cmd.action() == LFUN_ARGUMENT_INSERT) {
bool cotextinsert = false; bool cotextinsert = false;
InsetArgument * const ia = static_cast<InsetArgument *>(inset); InsetArgument * const ia = static_cast<InsetArgument *>(inset);