Hi,

once again, I would like to draw your attention to the attached patch. It fixes a serious problem with change-tracked output (text inside deleted insets appears as unchanged text).

Could someone please have a look at the code and do some testing?

As I will not be able to do any LyX work before tomorrow evening (i.e., before the release of LyX 1.5.0), could someone please commit the patch if the feedback is positive?

A thousand thanks in advance!

Michael

PS: LyX 1.5.0 will be great!
Index: src/OutputParams.h
===================================================================
--- src/OutputParams.h	(Revision 19046)
+++ src/OutputParams.h	(Arbeitskopie)
@@ -16,6 +16,7 @@
 
 #include "support/types.h"
 #include <boost/shared_ptr.hpp>
+#include "Changes.h"
 
 
 namespace lyx {
@@ -120,6 +121,16 @@
 	 */
 	bool inComment;
 
+	/** Whether we are inside an inset that is logically deleted.
+	 *  A value > 0 indicates a deleted inset.
+         */
+	int inDeletedInset;
+
+	/** The change information of the outermost, logically deleted inset.
+	 *  changeOfDeletedInset shall only be evaluated if inDeletedInset > 0.
+         */ 
+	Change changeOfDeletedInset;
+
 	/** allow output of only part of the top-level paragraphs
 	 *  par_begin: beginning paragraph
 	 */
Index: src/Paragraph.cpp
===================================================================
--- src/Paragraph.cpp	(Revision 19046)
+++ src/Paragraph.cpp	(Arbeitskopie)
@@ -190,7 +190,7 @@
 	///
 	void simpleTeXSpecialChars(Buffer const &, BufferParams const &,
 				   odocstream &,
-				   TexRow & texrow, OutputParams const &,
+				   TexRow & texrow, OutputParams &,
 				   Font & running_font,
 				   Font & basefont,
 				   Font const & outerfont,
@@ -661,7 +661,7 @@
 					     BufferParams const & bparams,
 					     odocstream & os,
 					     TexRow & texrow,
-					     OutputParams const & runparams,
+					     OutputParams & runparams,
 					     Font & running_font,
 					     Font & basefont,
 					     Font const & outerfont,
@@ -725,6 +725,11 @@
 			break;
 		}
 
+		if (lookupChange(i).type == Change::DELETED) {
+			if( ++runparams.inDeletedInset == 1)
+				runparams.changeOfDeletedInset = lookupChange(i);
+		}
+
 		if (inset->canTrackChanges()) {
 			column += Changes::latexMarkChange(os, bparams, running_change,
 				Change(Change::UNCHANGED));
@@ -779,6 +784,10 @@
 		} else {
 			column += os.tellp() - len;
 		}
+
+		if (lookupChange(i).type == Change::DELETED) {
+			--runparams.inDeletedInset;
+		}
 	}
 	break;
 
@@ -1923,7 +1932,7 @@
 				BufferParams const & bparams,
 				Font const & outerfont,
 				odocstream & os, TexRow & texrow,
-				OutputParams const & runparams) const
+				OutputParams & runparams) const
 {
 	LYXERR(Debug::LATEX) << "SimpleTeXOnePar...     " << this << endl;
 
@@ -2017,7 +2026,8 @@
 							    runparams.moving_arg);
 		}
 
-		Change const & change = pimpl_->lookupChange(i);
+		Change const & change = runparams.inDeletedInset ? runparams.changeOfDeletedInset
+		                                                 : pimpl_->lookupChange(i);
 
 		if (bparams.outputChanges && runningChange != change) {
 			if (open_font) {
Index: src/OutputParams.cpp
===================================================================
--- src/OutputParams.cpp	(Revision 19046)
+++ src/OutputParams.cpp	(Arbeitskopie)
@@ -22,7 +22,7 @@
 	  local_font(0), encoding(enc), free_spacing(false), use_babel(false),
 	  linelen(0), depth(0),
 	  exportdata(new ExportData),
-	  inComment(false),
+	  inComment(false), inDeletedInset(0), changeOfDeletedInset(Change::UNCHANGED),
 	  par_begin(0), par_end(0),
 	  dryrun(false)
 {}
Index: src/Paragraph.h
===================================================================
--- src/Paragraph.h	(Revision 19046)
+++ src/Paragraph.h	(Arbeitskopie)
@@ -126,7 +126,7 @@
 	///
 	bool simpleTeXOnePar(Buffer const &, BufferParams const &,
 			     Font const & outerfont, odocstream &,
-			     TexRow & texrow, OutputParams const &) const;
+			     TexRow & texrow, OutputParams &) const;
 
 	/// Can we drop the standard paragraph wrapper?
 	bool emptyTag() const;

Reply via email to