<new doc>z<enter>z<undo>

gives a crash.

This patch solves that by 1) fixing lockPath (the CursorSlice at level 0 was
missing) 2) eliminating some (bogus) redundant cursor positioning code in
undo

Ok?

Alfredo
? PosIterator.C-save
? PosIterator.h-save
? bfri.C
? textcursor.C-save
? textcursor.h-save
Index: iterators.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/iterators.C,v
retrieving revision 1.41
diff -u -p -u -r1.41 iterators.C
--- iterators.C	27 Jan 2004 15:14:34 -0000	1.41
+++ iterators.C	31 Jan 2004 10:38:36 -0000
@@ -224,7 +224,7 @@ ParIterator::ParIterator(PosIterator con
 void ParIterator::lockPath(BufferView * bv) const
 {
 	LCursor & cur = bv->cursor();
-	cur.cursor_.clear();
+	cur.reset();
 	int const last = size() - 1;
 	for (int i = 0; i < last; ++i)
 		(*positions_[i].it)->inset->edit(cur, true);
Index: undo.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/undo.C,v
retrieving revision 1.36
diff -u -p -u -r1.36 undo.C
--- undo.C	20 Jan 2004 14:25:12 -0000	1.36
+++ undo.C	31 Jan 2004 10:38:37 -0000
@@ -178,14 +178,6 @@ bool performUndoOrRedo(BufferView * bv, 
 	       << " pos: " << undo.cursor_pos
 	       << std::endl;
 
-	// set cursor again to force the position to be the right one
-	LCursor & cur = bv->cursor();
-	cur.par() = undo.cursor_par;
-	cur.pos() = undo.cursor_pos;
-
-	// clear any selection
-	cur.clearSelection();
-	cur.resetAnchor();
 	text->updateCounters();
 
 	// rebreak the entire lyxtext
@@ -193,7 +185,7 @@ bool performUndoOrRedo(BufferView * bv, 
 
 	pit.lockPath(bv);
 	text->setCursor(undo.cursor_par, undo.cursor_pos);
-	
+
 	finishUndo();
 	return true;
 }

Reply via email to