X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Foutput_plaintext.cpp;h=15e700eb8f1cf564d92b0eb273483d2942234a3a;hb=28be7d552f62cc02fa86d7f79201d089bfb2d7b5;hp=2b6af82a4354a133ddd7fb0bc50794660ec25247;hpb=d1f15298f7ed58e68aa2cbb4952ba74f7dee6ab1;p=lyx.git diff --git a/src/output_plaintext.cpp b/src/output_plaintext.cpp index 2b6af82a43..15e700eb8f 100644 --- a/src/output_plaintext.cpp +++ b/src/output_plaintext.cpp @@ -40,7 +40,8 @@ void writePlaintextFile(Buffer const & buf, FileName const & fname, // make sure we are ready to export buf.updateBuffer(); - buf.updateMacroInstances(); + buf.updateMacroInstances(OutputUpdate); + buf.makeCitationLabels(); writePlaintextFile(buf, ofs, runparams); } @@ -71,11 +72,12 @@ static pair addDepth(int depth, int ldepth) return make_pair(d, docstring(d, ' ')); } + void writePlaintextParagraph(Buffer const & buf, Paragraph const & par, - odocstream & os, + odocstream & ods, OutputParams const & runparams, - bool & ref_printed) + bool & ref_printed, size_t max_length) { int ltype = 0; depth_type ltype_depth = 0; @@ -119,6 +121,7 @@ void writePlaintextParagraph(Buffer const & buf, string::size_type currlinelen = 0; + odocstringstream os; os << docstring(depth * 2, ' '); currlinelen += depth * 2; @@ -182,6 +185,9 @@ void writePlaintextParagraph(Buffer const & buf, if (par.isDeleted(i)) continue; + if (os.str().size() > max_length) + break; + char_type c = par.getUChar(buf.params(), i); if (par.isInset(i) || c == ' ') { @@ -200,7 +206,7 @@ void writePlaintextParagraph(Buffer const & buf, if (par.isInset(i)) { OutputParams rp = runparams; rp.depth = par.params().depth(); - int len = par.getInset(i)->plaintext(os, rp); + int len = par.getInset(i)->plaintext(os, rp, max_length); if (len >= Inset::PLAINTEXT_NEWLINE) currlinelen = len - Inset::PLAINTEXT_NEWLINE; else @@ -211,7 +217,7 @@ void writePlaintextParagraph(Buffer const & buf, switch (c) { case ' ': os << ' '; - currlinelen++; + ++currlinelen; break; case '\0': @@ -236,6 +242,7 @@ void writePlaintextParagraph(Buffer const & buf, } os << word; } + ods << os.str(); }