>>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes:

Martin> Make a small text file in which you embed the attached XFig
Martin> figure as an external inset. Then insert an erroneous ERT,
Martin> (e.g. \crash) both in the paragraph before and the one after
Martin> it; run LaTeX and see if the error boxes land right.

Everything seems allright with this patch. Does anybody have
objections? This is 1.3.x-only.

JMarc

PS: actually I had some problems with your .fig file:
  1/ I had to add \usepackage{color} in the preamble. Is this
  expected?
  2/ when there is an error in the pstex_t file, the log analyzer
  believes that the error is in the main file and thus misuses line
  numbers. This is very confusing...

Index: src/insets/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v
retrieving revision 1.552.2.22
diff -u -p -r1.552.2.22 ChangeLog
--- src/insets/ChangeLog	7 Mar 2005 14:03:08 -0000	1.552.2.22
+++ src/insets/ChangeLog	31 Mar 2005 12:51:37 -0000
@@ -1,3 +1,11 @@
+2005-03-31  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* insetgraphics.C (latex): fix off-by-one error in number of
+	newlines.
+
+	* insetexternal.C (write): compute correctly the number of lines
+	in output.
+
 2005-02-26  Michael Schmitt  <[EMAIL PROTECTED]>
 
 	* insetbib.C: change screen label
Index: src/insets/insetexternal.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetexternal.C,v
retrieving revision 1.53.2.4
diff -u -p -r1.53.2.4 insetexternal.C
--- src/insets/insetexternal.C	10 Jan 2005 19:17:30 -0000	1.53.2.4
+++ src/insets/insetexternal.C	31 Mar 2005 12:51:37 -0000
@@ -26,6 +26,7 @@
 #include "support/filetools.h"
 #include "support/forkedcall.h"
 #include "support/lstrings.h"
+#include "support/lyxalgo.h"
 #include "support/package.h"
 #include "support/path.h"
 
@@ -146,8 +147,9 @@ int InsetExternal::write(string const & 
 	}
 
 	updateExternal(format, buf);
-	os << doSubstitution(buf, cit->second.product);
-	return 0; // CHECK  (FIXME check what ? - jbl)
+	string const outstring = doSubstitution(buf, cit->second.product);
+	os << outstring;
+	return lyx::count(outstring.begin(), outstring.end(), '\n');
 }
 
 
Index: src/insets/insetgraphics.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v
retrieving revision 1.146.2.6
diff -u -p -r1.146.2.6 insetgraphics.C
--- src/insets/insetgraphics.C	10 Jan 2005 19:17:30 -0000	1.146.2.6
+++ src/insets/insetgraphics.C	31 Mar 2005 12:51:37 -0000
@@ -779,10 +779,7 @@ int InsetGraphics::latex(Buffer const *b
 	os << latex_str;
 
 	// Return how many newlines we issued.
-	int const newlines =
-		int(lyx::count(latex_str.begin(), latex_str.end(),'\n') + 1);
-
-	return newlines;
+	return int(lyx::count(latex_str.begin(), latex_str.end(),'\n'));
 }
 
 

Reply via email to