This patch is a fallout of the my plaintext work. It goes in now.

Georg

Log:
Fix return value of InsetText::plaintext
        * src/insets/insetnote.C
        (InsetNote::plaintext): Move line counting code from here ...

        * src/insets/insettext.C
        (InsetText::plaintext): ... here.
Index: src/insets/insetnote.C
===================================================================
--- src/insets/insetnote.C	(Revision 14955)
+++ src/insets/insetnote.C	(Arbeitskopie)
@@ -333,15 +333,12 @@ int InsetNote::plaintext(Buffer const & 
 		// Ignore files that are exported inside a comment
 		runparams.exportdata.reset(new ExportData);
 	}
-	ostringstream ss;
-	ss << "[";
-	InsetText::plaintext(buf, ss, runparams);
-	ss << "]";
+	os << "[";
+	int const nlines = InsetText::plaintext(buf, os, runparams);
+	os << "]";
 
-	string const str = ss.str();
-	os << str;
 	// Return how many newlines we issued.
-	return int(lyx::count(str.begin(), str.end(),'\n'));
+	return nlines;
 }
 
 
Index: src/insets/insettext.C
===================================================================
--- src/insets/insettext.C	(Revision 14955)
+++ src/insets/insettext.C	(Arbeitskopie)
@@ -294,11 +294,14 @@ int InsetText::plaintext(Buffer const & 
 	ParagraphList::const_iterator end = paragraphs().end();
 	ParagraphList::const_iterator it = beg;
 	bool ref_printed = false;
+	std::ostringstream oss;
 	for (; it != end; ++it)
-		asciiParagraph(buf, *it, os, runparams, ref_printed);
+		asciiParagraph(buf, *it, oss, runparams, ref_printed);
 
-	// FIXME: Give the total numbers of lines
-	return 1;
+	string const str = oss.str();
+	os << str;
+	// Return how many newlines we issued.
+	return int(lyx::count(str.begin(), str.end(), '\n'));
 }
 
 

Reply via email to