diff --git a/src/OutputParams.h b/src/OutputParams.h index 4534b22c6e..3b97a3e84d 100644 --- a/src/OutputParams.h +++ b/src/OutputParams.h @@ -79,6 +79,8 @@ public: This esentially seems to mean whether InsetInclude, InsetGraphics and InsetExternal should add the absolute path to any external files or not. + Non-nice LaTeX also includes additional safe line breaks in order to + increase the precision of forward/reverse search and error reporting. */ bool nice; diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp index 8211ba3634..a92c09525c 100644 --- a/src/insets/InsetListings.cpp +++ b/src/insets/InsetListings.cpp @@ -224,10 +224,13 @@ void InsetListings::latex(otexstream & os, OutputParams const & runparams) const OutputParams rp = runparams; rp.moving_arg = true; TexString caption = getCaption(rp); + os << breakln << "\\begin{lstlisting}"; if (param_string.empty() && caption.str.empty()) - os << breakln << "\\begin{lstlisting}\n"; + os << "\n"; else { - os << breakln << "\\begin{lstlisting}["; + if (!runparams.nice) + os << safebreakln; + os << "["; if (!caption.str.empty()) { os << "caption={" << move(caption) << '}'; if (!param_string.empty())