From: Jean-Marc Lasgouttes Date: Tue, 17 Apr 2012 08:55:59 +0000 (+0200) Subject: Simpler fix for undo support when entering \hline in an equation X-Git-Tag: 2.1.0beta1~1933^2~28 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=9059843121c419e7de564005fb72e34cc3a48ad1;p=lyx.git Simpler fix for undo support when entering \hline in an equation * 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) --- diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp index ed77f71f85..ac8cd491ac 100644 --- a/src/mathed/InsetMathGrid.cpp +++ b/src/mathed/InsetMathGrid.cpp @@ -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) diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index c2f4fc16ba..5d35d779e3 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -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)));