]> git.lyx.org Git - features.git/commitdiff
Generalize control on double blank lines.
authorEnrico Forestieri <forenr@lyx.org>
Tue, 20 May 2014 19:52:29 +0000 (21:52 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Tue, 20 May 2014 19:52:29 +0000 (21:52 +0200)
We can now tell whether a blank line was just output and so can
avoid outputting another one.

src/mathed/InsetMathNest.cpp
src/output_latex.cpp

index 2b6b9a3a3d91d650131783a6f1fc373a8c361242..12615e6865f926187f4b97f245bede53db1c2cf0 100644 (file)
@@ -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();
index 1f47ca73a1d909cab111e8e0ef6867604d3be39c..7995f653a66fa6f86fafd09b176d091111a43e00 100644 (file)
@@ -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();