Am 12.08.2011 20:12, schrieb Vincent van Ravesteijn:

Paragraph::insert(...) just calls Paragraph::insertChar(). Looking at 
Paragraph::insertChar(...,
bool trackChanges) you can see that this does nothing else than 
Paragraph::insertChar(..., Change
const & change) except for using "Change(trackChanges ? Change::INSERTED : 
Change::UNCHANGED)".

Thanks!

The attached patch now works also in case of ChangeTracking correctly.

So what is now only missing is to allow to insert a protected space in LyX-Code.

regards Uwe
Index: Paragraph.cpp
===================================================================
--- Paragraph.cpp	(revision 39484)
+++ Paragraph.cpp	(working copy)
@@ -903,8 +903,11 @@
 		os << '\n';
 		os.texrow().start(owner_->id(), i + 1);
 		column = 0;
-	} else if (style.free_spacing) {
-		os << '~';
+	}
+	// we need a normal space here ('\ ') that allows line breaks
+	// and no protected space ('~') see bug #4742
+	else if (style.free_spacing) {
+		os << "\\ ";
 	} else {
 		os << ' ';
 	}
Index: Text.cpp
===================================================================
--- Text.cpp	(revision 39484)
+++ Text.cpp	(working copy)
@@ -788,8 +788,12 @@
 				++pos;
 				space_inserted = true;
 			} else {
-				par.insertChar(pos, *cit, font, bparams.trackChanges);
-				++pos;
+				// transfporm tabulators to 4 spaces because LaTeX cannot handle
+				// tabulators and outputting a single space instead is not what we
+				// want in FreeSpacing mode
+				par.insert(pos, from_ascii("    "), font, Change(bparams.trackChanges ?
+					   Change::INSERTED : Change::UNCHANGED));
+				pos = pos + 4;
 				space_inserted = true;
 			}
 		} else if (!isPrintable(*cit)) {

Reply via email to