From 7145863466c38080db9bdfba6ee7bb7583ffb862 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Tue, 20 May 2014 21:52:29 +0200 Subject: [PATCH] Generalize control on double blank lines. We can now tell whether a blank line was just output and so can avoid outputting another one. --- src/mathed/InsetMathNest.cpp | 2 ++ src/output_latex.cpp | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 2b6b9a3a3d..12615e6865 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -402,6 +402,8 @@ void InsetMathNest::latex(otexstream & os, OutputParams const & runparams) const runparams.encoding); wi.canBreakLine(os.canBreakLine()); write(wi); + // Reset parbreak status after a math inset. + os.lastChar(0); os.canBreakLine(wi.canBreakLine()); int lf = wi.line(); diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 1f47ca73a1..7995f653a6 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -856,7 +856,7 @@ void TeXOnePar(Buffer const & buf, case LATEX_LIST_ENVIRONMENT: if (nextpar && (par.params().depth() < nextpar->params().depth()) - && !par.isEnvSeparator(par.size() - 1)) + && !os.afterParbreak()) pending_newline = true; break; case LATEX_ENVIRONMENT: { @@ -872,7 +872,7 @@ void TeXOnePar(Buffer const & buf, default: // we don't need it for the last paragraph!!! // or if the last thing is an environment separator - if (nextpar && par.size() > 0 && !par.isEnvSeparator(par.size() - 1)) + if (nextpar && !os.afterParbreak()) pending_newline = true; } @@ -1018,7 +1018,7 @@ void TeXOnePar(Buffer const & buf, // we don't need a newline for the last paragraph!!! // Note from JMarc: we will re-add a \n explicitly in // TeXEnvironment, because it is needed in this case - if (nextpar && par.size() > 0 && !par.isEnvSeparator(par.size() - 1)) { + if (nextpar && !os.afterParbreak()) { // Make sure to start a new line os << breakln; Layout const & next_layout = nextpar->layout(); -- 2.39.2