Daniel Watkins wrote:
> Bug 2058 (http://bugzilla.lyx.org/show_bug.cgi?id=2058): LyX crashes
> when attempting to undo matrix deletion
> Description:
> When I attempt to undo (using Ctrl-Z) the deletion of a matrix (deleted
> by pressing Backspace at the start of the top-left box), LyX crashes
> with the appended CLI output.

The attached patch fixes it for me.

Jürgen
Index: math_gridinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_gridinset.C,v
retrieving revision 1.168
diff -p -u -r1.168 math_gridinset.C
--- math_gridinset.C	18 Jul 2005 00:09:20 -0000	1.168
+++ math_gridinset.C	2 Oct 2005 09:38:30 -0000
@@ -1043,7 +1043,7 @@ void MathGridInset::doDispatch(LCursor &
 		// FIXME: We use recordUndoInset when a change reflects more
 		// than one cell, because recordUndo does not work for
 		// multiple cells. Unfortunately this puts the cursor in front
-		// of the inset after undo. This is (especilally for large
+		// of the inset after undo. This is (especially for large
 		// grids) annoying.
 		recordUndoInset(cur);
 		//autocorrect_ = false;
@@ -1058,6 +1058,15 @@ void MathGridInset::doDispatch(LCursor &
 			cur.idx() = cur.lastidx();
 		if (cur.pos() > cur.lastpos())
 			cur.pos() = cur.lastpos();
+		break;
+
+	case LFUN_BACKSPACE:
+		if (cur.pos() == 0)
+			// delete whole cell
+			recordUndoInset(cur, Undo::ATOMIC);
+		else
+			recordUndo(cur, Undo::ATOMIC);
+		cur.backspace();
 		break;
 
 	case LFUN_CELL_SPLIT:

Reply via email to