Le 12/04/2012 20:56, Georg Baum a écrit :
Jean-Marc Lasgouttes wrote:

What was the recipe that lead to a problem?

revert 1fa39e1f953434, create an equation array and enter \hline in any cell
with the keyboard. This will produce a horizontal line, but undo does not
work afterwards. If you only revert the undo group part of 1fa39e1f953434,
and keep the changes in InsetMathGrid::interpretString(), undo will work,
but two undo entries are produced (only the top of the undo stack will
change somehing if executed).

Here is what I would do after reverting 1fa39e1f953434. Does that seem to work for you? THe idea is to only record undo (inset) once before the insertion of the unknown inset.

JMarc



diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index c2f4fc1..5d35d77 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)));

Reply via email to