]> git.lyx.org Git - features.git/commitdiff
Fix return value of InsetText::plaintext
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sun, 10 Sep 2006 08:41:39 +0000 (08:41 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sun, 10 Sep 2006 08:41:39 +0000 (08:41 +0000)
* src/insets/insetnote.C
(InsetNote::plaintext): Move line counting code from here ...

* src/insets/insettext.C
(InsetText::plaintext): ... here.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14957 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/insetnote.C
src/insets/insettext.C

index 82ed210bab629622bba48cca6287e864cc095054..a55e8631195c6330268476b7803f29040511e508 100644 (file)
@@ -333,15 +333,12 @@ int InsetNote::plaintext(Buffer const & buf, std::ostream & os,
                // 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 a4b4080516826b75588ea4db4ffb8a9042e44bc0..1b90b0d3e1bcfa52b4bf3c3f95f9e17405e28ad0 100644 (file)
@@ -294,11 +294,14 @@ int InsetText::plaintext(Buffer const & buf, ostream & os,
        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'));
 }