The attached patch fixes bug 1620, although I am not sure wether this 
newline problem exists at other places, too. Therefore the FIXME. I am 
going to apply this if nobody complains.


Georg
Index: src/tex2lyx/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/ChangeLog,v
retrieving revision 1.59
diff -u -r1.59 ChangeLog
--- src/tex2lyx/ChangeLog	12 Oct 2004 08:44:38 -0000	1.59
+++ src/tex2lyx/ChangeLog	15 Oct 2004 09:32:19 -0000
@@ -1,3 +1,8 @@
+2004-10-20  Georg Baum  <[EMAIL PROTECTED]>
+
+	* text.C (parse_text): replace newlines with spaces in arguments to
+	known latex commands, fixes bug 1620
+
 2004-10-12  Georg Baum  <[EMAIL PROTECTED]>
 
 	* preamble.C (end_preamble): change file format from 236 to 237
Index: src/tex2lyx/text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/text.C,v
retrieving revision 1.42
diff -u -r1.42 text.C
--- src/tex2lyx/text.C	5 Oct 2004 10:11:42 -0000	1.42
+++ src/tex2lyx/text.C	15 Oct 2004 09:32:19 -0000
@@ -1553,9 +1784,11 @@
 			context.check_layout(os);
 			begin_inset(os, "LatexCommand ");
 			os << '\\' << t.cs();
-			os << p.getOpt();
-			os << p.getOpt();
-			os << '{' << p.verbatim_item() << "}\n";
+			// lyx cannot handle newlines in a latex command
+			// FIXME: Move the substitution into parser::getOpt()?
+			os << subst(p.getOpt(), "\n", " ");
+			os << subst(p.getOpt(), "\n", " ");
+			os << '{' << subst(p.verbatim_item(), "\n", " ") << "}\n";
 			end_inset(os);
 		}
 

Reply via email to