]> git.lyx.org Git - lyx.git/commitdiff
Simpler fix for undo support when entering \hline in an equation
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 17 Apr 2012 08:55:59 +0000 (10:55 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 17 Apr 2012 20:21:45 +0000 (22:21 +0200)
 * Avoid undo step when using backspace in macro mode
 * Use recordUndoInset when entering macro mode (if one enters something like \hline, the outer inset itself will be modified)
 * Use recordUndoInset when pasting in an INsetMathGrid (same reason as above)

src/mathed/InsetMathGrid.cpp
src/mathed/InsetMathNest.cpp

index ed77f71f851be12a46fa959b5b0f9c7e81d0defc..ac8cd491acb8d50dafc3e132722550a1810fb381 100644 (file)
@@ -1356,7 +1356,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
                        hline_enabled = status.enabled();
                if (grid.nargs() == 1) {
                        // single cell/part of cell
-                       cur.recordUndo();
+                       cur.recordUndoInset();
                        cur.cell().insert(cur.pos(), grid.cell(0));
                        cur.pos() += grid.cell(0).size();
                        if (hline_enabled)
index c2f4fc16ba5deabdc0e1a9ae2d4e610c038e0927..5d35d779e300c7b923f70c33af56b3f6428db38f 100644 (file)
@@ -806,7 +806,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                if (cur.pos() == 0)
                        // May affect external cell:
                        cur.recordUndoInset();
-               else
+               else if (!cur.inMacroMode())
                        cur.recordUndoSelection();
                // if the inset can not be removed from within, delete it
                if (!cur.backspace()) {
@@ -1705,6 +1705,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
                //lyxerr << "starting with macro" << endl;
                bool reduced = cap::reduceSelectionToOneCell(cur);
                if (reduced || !cur.selection()) {
+                       cur.recordUndoInset();
                        docstring const safe = cap::grabAndEraseSelection(cur);
                        if (!cur.inRegexped())
                                cur.insert(MathAtom(new InsetMathUnknown(from_ascii("\\"), safe, false)));