]> git.lyx.org Git - lyx.git/blobdiff - src/Cursor.cpp
Fix a copy-paste error introduced in b754fb02
[lyx.git] / src / Cursor.cpp
index fb4988f787ec7d8889f6b685347a51cd612100e2..be042940a081b3806ca129c6f0d657f8f081b99e 100644 (file)
@@ -334,7 +334,7 @@ void Cursor::dispatch(FuncRequest const & cmd0)
        Cursor old = *this;
        disp_ = DispatchResult();
 
-       buffer()->undo().beginUndoGroup();
+       beginUndoGroup();
 
        // Is this a function that acts on inset at point?
        if (lyxaction.funcHasFlag(cmd.action(), LyXAction::AtPoint)
@@ -346,7 +346,7 @@ void Cursor::dispatch(FuncRequest const & cmd0)
                        << cmd0 << endl << *this);
                nextInset()->dispatch(*this, tmpcmd);
                if (disp_.dispatched()) {
-                       buffer()->undo().endUndoGroup();
+                       endUndoGroup();
                        return;
                }
        }
@@ -391,7 +391,7 @@ void Cursor::dispatch(FuncRequest const & cmd0)
                // are possible which would change it
                beforeDispatchCursor_ = safe.beforeDispatchCursor_;
        }
-       buffer()->undo().endUndoGroup();
+       endUndoGroup();
 
        // notify insets we just left
        if (*this != old) {
@@ -1599,8 +1599,11 @@ bool Cursor::macroModeClose()
 
        docstring const name = s.substr(1);
        InsetMathNest * const in = inset().asInsetMath()->asNestInset();
-       if (in && in->interpretString(*this, s))
+       if (in && in->interpretString(*this, s)) {
+               // end undo group that was opened before in was created
+               endUndoGroup();
                return true;
+       }
        MathAtom atom = buffer()->getMacro(name, *this, false) ?
                MathAtom(new MathMacro(buffer(), name)) : createInsetMath(name, buffer());
 
@@ -1633,7 +1636,9 @@ bool Cursor::macroModeClose()
                else
                        insert(selection);
        }
-       
+
+       // end undo group that was opened before in was created
+       endUndoGroup();
        return true;
 }
 
@@ -2413,7 +2418,7 @@ void Cursor::beginUndoGroup() const
 
 void Cursor::endUndoGroup() const
 {
-       buffer()->undo().endUndoGroup();
+       buffer()->undo().endUndoGroup(*this);
 }