]> 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>
Thu, 18 Jul 2024 21:40:39 +0000 (23:40 +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.

(cherry picked from commit 82f387dabc2b18de6a9917192f4304e92bff8bc1)

src/Text.cpp
status.24x

index d314c251ae467eb0923dfab3bc79ae19284802e7..767117a33af62f89c7c45d3027622c7b55fae0ad 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);
index 8e6a63cb9ce547ed870911c0df49bf989ce6bbfe..42df3bb1fe1cf7eacc679673459eca33e75b6991 100644 (file)
@@ -67,6 +67,8 @@ What's new
 
 * INTERNALS
 
+- Fix possible crash in undo code after inserting note inset over a multi-paragraph
+  selection.
 
 
 * DOCUMENTATION AND LOCALIZATION