From 05491c58ccc5b8c338684dfd047a1c95ef745c91 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Mon, 14 Feb 2011 17:09:39 +0000 Subject: [PATCH] Also catch the endl manipulator for automatic line counting. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37657 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Buffer.cpp | 3 +-- src/support/docstream.cpp | 9 +++++++++ src/support/docstream.h | 5 +++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index f8258acee9..6ed365c894 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -1453,8 +1453,7 @@ void Buffer::writeLaTeXSource(otexstream & os, d->setParent(save_parent); // add this just in case after all the paragraphs - os.os() << endl; - os.texrow().newline(); + os << endl; if (output_preamble) { os << "\\end{document}\n"; diff --git a/src/support/docstream.cpp b/src/support/docstream.cpp index 56a78e8325..f5cf297c12 100644 --- a/src/support/docstream.cpp +++ b/src/support/docstream.cpp @@ -447,6 +447,15 @@ otexstream & operator<<(otexstream & ots, SafeBreakLine) } +otexstream & operator<<(otexstream & ots, odocstream_manip pf) +{ + ots.os() << pf; + if (pf == static_cast(endl)) + ots.texrow().newline(); + return ots; +} + + otexstream & operator<<(otexstream & ots, docstring const & s) { size_t const len = s.length(); diff --git a/src/support/docstream.h b/src/support/docstream.h index 08d7dd0e74..920eafb5f5 100644 --- a/src/support/docstream.h +++ b/src/support/docstream.h @@ -83,6 +83,9 @@ typedef std::basic_istringstream idocstringstream; /// UCS4 output stringstream typedef std::basic_ostringstream odocstringstream; +/// UCS4 output manipulator +typedef odocstream & (*odocstream_manip)(odocstream &); + /** Wrapper class for odocstream. This class is used to automatically count the lines of the exported latex code and also to ensure that no blank lines may be inadvertently output. @@ -140,6 +143,8 @@ otexstream & operator<<(otexstream &, BreakLine); /// otexstream & operator<<(otexstream &, SafeBreakLine); /// +otexstream & operator<<(otexstream &, odocstream_manip); +/// otexstream & operator<<(otexstream &, docstring const &); /// otexstream & operator<<(otexstream &, char const *); -- 2.39.2