]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetVSpace.cpp
DocBook, InsetFloat: avoid a potential nullptr dereference when detecting the type...
[features.git] / src / insets / InsetVSpace.cpp
index a6092cb8a337ba8f5098a4e143f5cece21a37521..80fba4dd1d861270e25f1d730625aa5bfef0c8ab 100644 (file)
@@ -22,7 +22,6 @@
 #include "FuncStatus.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
-#include "OutputParams.h"
 #include "xml.h"
 #include "texstream.h"
 #include "Text.h"
@@ -50,7 +49,7 @@ int const ADD_TO_VSPACE_WIDTH = 5;
 
 
 InsetVSpace::InsetVSpace(VSpace const & space)
-       : Inset(0), space_(space)
+       : Inset(nullptr), space_(space)
 {}
 
 
@@ -210,9 +209,15 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
 }
 
 
-void InsetVSpace::latex(otexstream & os, OutputParams const &) const
+void InsetVSpace::latex(otexstream & os, OutputParams const & rp) const
 {
-       os << from_ascii(space_.asLatexCommand(buffer().params())) << '\n';
+       os << from_ascii(space_.asLatexCommand(buffer().params())) << breakln;
+       if (rp.need_noindent) {
+               // If the paragraph starts with a vspace and has more than that
+               // content, the \\noindent needs to come after that
+               // (as \\noindent leaves vmode).
+               os << "\\noindent" << termcmd;
+       }
 }