I cannot remember whether I posted this patch, so here it comes again.
This patch fixes two things:

- a crash when toggling off change tracking and the cursor is inside
  an inset

- the first change is always skipped when merge changes is
  automatically invoked by this function.

The patch is rather straightforward, actually.

Lars?

JMarc

Index: src/BufferView_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.593
diff -u -p -r1.593 BufferView_pimpl.C
--- src/BufferView_pimpl.C	2 Aug 2005 14:25:47 -0000	1.593
+++ src/BufferView_pimpl.C	6 Sep 2005 16:29:56 -0000
@@ -877,13 +877,13 @@ void BufferView::Pimpl::trackChanges()
 		// We cannot allow undos beyond the freeze point
 		buffer_->undostack().clear();
 	} else {
-		update();
-		bv_->text()->setCursor(cursor_, 0, 0);
-#ifdef WITH_WARNINGS
-#warning changes FIXME
-#endif
+		cursor_.setCursor(doc_iterator_begin(buffer_->inset()));
 		bool const found = lyx::find::findNextChange(bv_);
 		if (found) {
+			// We reset the cursor to the start of the
+			// document, since the Changes Dialog is going
+			// to search for the next change anyway.
+			cursor_.setCursor(doc_iterator_begin(buffer_->inset()));
 			owner_->getDialogs().show("changes");
 			return;
 		}
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.2267
diff -u -p -r1.2267 ChangeLog
--- src/ChangeLog	5 Sep 2005 06:50:40 -0000	1.2267
+++ src/ChangeLog	6 Sep 2005 16:29:57 -0000
@@ -1,8 +1,16 @@
+2005-08-04  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* lyxfind.C (findNextChange): tiny cleanup.
+
+	* BufferView_pimpl.C (trackChanges): avoid crash when stopping
+	change tracking with the cursor in an inset; make sure the first
+	change is not skipped.
+
 2005-08-26  Georg Baum  <[EMAIL PROTECTED]>
 
 	* text2.C (cursorEnd): check for empty text (fixes bug 1998)
 
-2005-08-19  Lars Gullik Bjønnes  <[EMAIL PROTECTED]>
+2005-08-19  Lars Gullik Bjønnes  <[EMAIL PROTECTED]>
 
 	* CutAndPaste.C (eraseSelectionHelper): fix bug 1920
 	use old deleteion algorithm when changetracking is on.
Index: src/lyxfind.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfind.C,v
retrieving revision 1.95
diff -u -p -r1.95 lyxfind.C
--- src/lyxfind.C	14 Jul 2005 22:09:20 -0000	1.95
+++ src/lyxfind.C	6 Sep 2005 16:29:57 -0000
@@ -339,7 +339,7 @@ bool findNextChange(BufferView * bv)
 	if (!bv->available())
 		return false;
 
-	DocIterator cur = DocIterator(bv->cursor());
+	DocIterator cur = bv->cursor();
 
 	if (!findChange(cur))
 		return false;

Reply via email to