[LyX/master] Fix cursor position when undoing inset-dissolve.

Jean-Marc Lasgouttes lasgouttes at lyx.org
Tue Feb 23 18:21:21 UTC 2021


commit f59dafe898513c2466a7cd33793320ebdfe9035d
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Tue Feb 23 19:19:57 2021 +0100

    Fix cursor position when undoing inset-dissolve.
    
    When invoking inset-dissolve with the cursor in front of the inset,
    add recordUndo call to make sure that the cursor is at the right
    class.
    
    Fixes bug #12164.
---
 src/insets/InsetText.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index fa1f40c..2253ed6 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -327,13 +327,14 @@ void InsetText::doDispatch(Cursor & cur, FuncRequest & cmd)
 			|| cmd.getArg(0) == insetName(lyxCode());
 
 		if (!main_inset && target_inset) {
+			UndoGroupHelper ugh(&buffer());
 			// Text::dissolveInset assumes that the cursor
 			// is inside the Inset.
-			if (&cur.inset() != this)
+			if (&cur.inset() != this) {
+				cur.recordUndo();
 				cur.pushBackward(*this);
-			cur.beginUndoGroup();
+			}
 			text_.dispatch(cur, cmd);
-			cur.endUndoGroup();
 		} else
 			cur.undispatched();
 		break;


More information about the lyx-cvs mailing list