]> git.lyx.org Git - features.git/commitdiff
* src/insettext.C: fix line lengths and par breaks in plaintext()
authorMichael Schmitt <michael.schmitt@teststep.org>
Thu, 15 Feb 2007 22:04:33 +0000 (22:04 +0000)
committerMichael Schmitt <michael.schmitt@teststep.org>
Thu, 15 Feb 2007 22:04:33 +0000 (22:04 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17205 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/insettext.C

index 23096b7ae41bd3f389197040d2fae0efca39e026..dcc5a7adc91542c77c03e7763fb5a6cb9d74248c 100644 (file)
@@ -31,6 +31,7 @@
 #include "lyxrc.h"
 #include "lyxtext.h"
 #include "metricsinfo.h"
+#include "outputparams.h"
 #include "output_docbook.h"
 #include "output_latex.h"
 #include "output_plaintext.h"
@@ -305,14 +306,23 @@ int InsetText::plaintext(Buffer const & buf, odocstream & os,
        ParagraphList::const_iterator end = paragraphs().end();
        ParagraphList::const_iterator it = beg;
        bool ref_printed = false;
-       odocstringstream oss;
-       for (; it != end; ++it)
+       int len = 0;
+       for (; it != end; ++it) {
+               if (it != beg) {
+                       os << '\n';
+                       if (runparams.linelen > 0)
+                               os << '\n';
+               }
+               odocstringstream oss;
                writePlaintextParagraph(buf, *it, oss, runparams, ref_printed);
+               docstring const str = oss.str();
+               os << str;
+               // FIXME: len is not computed fully correctly; in principle,
+               // we have to count the characters after the last '\n'
+               len = str.size();
+       }
 
-       docstring const str = oss.str();
-       os << str;
-       // Return how many newlines we issued.
-       return int(lyx::count(str.begin(), str.end(), '\n'));
+       return len;
 }