Safe line break to increase precision of error reporting in Listings caption

This commit is contained in:
Guillaume Munch 2016-10-10 16:52:32 +02:00
parent d9c52c7a3f
commit e798db5739
2 changed files with 7 additions and 2 deletions

View File

@ -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;

View File

@ -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())