]> git.lyx.org Git - lyx.git/commitdiff
Fix faulty undo recording
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 16 Jul 2024 13:43:11 +0000 (15:43 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 16 Jul 2024 13:43:11 +0000 (15:43 +0200)
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.

src/Text.cpp

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