X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftexstream.cpp;h=1523ca9470ebf2447af87ec8f8dc7e446c58403e;hb=3209e6604ef132c8488ad14719b29406899d8b00;hp=10033a9255da7e5c4b63d39157d698992b2ee446;hpb=66f7c2930ad5ba39f4b874a0d3b00fd55edfe4c4;p=lyx.git diff --git a/src/texstream.cpp b/src/texstream.cpp index 10033a9255..1523ca9470 100644 --- a/src/texstream.cpp +++ b/src/texstream.cpp @@ -68,8 +68,8 @@ void otexstream::put(char_type const & c) protectspace_ = false; } if (terminate_command_) { - if ((c == ' ' || c == '\0') && !isprotected) - // A space follows. Terminate with brackets. + if ((c == ' ' || c == '\0' || c == '\n') && !isprotected) + // A space or line break follows. Terminate with brackets. os() << "{}"; else if (c != '\\' && c != '{' && c != '}') // Non-terminating character follows. Terminate with space. @@ -107,6 +107,8 @@ TerminateCommand termcmd; otexstream & operator<<(otexstream & ots, BreakLine) { if (ots.canBreakLine()) { + if (ots.terminateCommand()) + ots << "{}"; ots.otexrowstream::put('\n'); ots.lastChar('\n'); } @@ -120,6 +122,8 @@ otexstream & operator<<(otexstream & ots, SafeBreakLine) { otexrowstream & otrs = ots; if (ots.canBreakLine()) { + if (ots.terminateCommand()) + otrs << "{}"; otrs << "%\n"; ots.lastChar('\n'); } @@ -175,7 +179,7 @@ otexstream & operator<<(otexstream & ots, TexString ts) otexrowstream & otrs = ots; bool isprotected = false; - char const c = ts.str[0]; + char_type const c = ts.str[0]; if (ots.protectSpace()) { if (!ots.canBreakLine() && c == ' ') { otrs << "{}"; @@ -184,8 +188,8 @@ otexstream & operator<<(otexstream & ots, TexString ts) ots.protectSpace(false); } if (ots.terminateCommand()) { - if ((c == ' ' || c == '\0') && !isprotected) - // A space follows. Terminate with brackets. + if ((c == ' ' || c == '\0' || c == '\n') && !isprotected) + // A space or line break follows. Terminate with brackets. otrs << "{}"; else if (c != '\\' && c != '{' && c != '}') // Non-terminating character follows. Terminate with space. @@ -219,7 +223,7 @@ otexstream & operator<<(otexstream & ots, docstring const & s) return ots; otexrowstream & otrs = ots; bool isprotected = false; - char const c = s[0]; + char_type const c = s[0]; if (ots.protectSpace()) { if (!ots.canBreakLine() && c == ' ') { otrs << "{}"; @@ -228,8 +232,8 @@ otexstream & operator<<(otexstream & ots, docstring const & s) ots.protectSpace(false); } if (ots.terminateCommand()) { - if ((c == ' ' || c == '\0') && !isprotected) - // A space follows. Terminate with brackets. + if ((c == ' ' || c == '\0' || c == '\n') && !isprotected) + // A space or line break follows. Terminate with brackets. otrs << "{}"; else if (c != '\\' && c != '{' && c != '}') // Non-terminating character follows. Terminate with space. @@ -326,7 +330,7 @@ template otexrowstream & operator<< (otexrowstream &, template otexrowstream & operator<< (otexrowstream &, unsigned long); -#ifdef LYX_USE_LONG_LONG +#ifdef HAVE_LONG_LONG_INT template otexrowstream & operator<< (otexrowstream &, unsigned long long); #endif @@ -347,8 +351,8 @@ template otexstream & operator<< (otexstream &, double); template otexstream & operator<< (otexstream &, int); template otexstream & operator<< (otexstream &, unsigned int); template otexstream & operator<< (otexstream &, unsigned long); -#ifdef LYX_USE_LONG_LONG +#ifdef HAVE_LONG_LONG_INT template otexstream & operator<< (otexstream &, unsigned long long); #endif -} +} // namespace lyx