Currently, if an inset outputs a newline, the new latex row is still
associated with a previous id/pos. Now, if a latex error occurs before
this newline, we would still highlight everything associated to that
id/pos, even if it is extraneous to the error.
This is avoided by associating the new latex row with the id/pos in
effect right before entering the inset. If an inset does not output
a newline, it is not excluded from the selection, consistent with the
fact that the text of the inset does appear in the error description.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37903
a592a061-630c-0410-9148-
cb99ea01b6c8
inComment(false), inTableCell(NO), inFloat(NONFLOAT),
inIndexEntry(false), inDeletedInset(0),
changeOfDeletedInset(Change::UNCHANGED),
- par_begin(0), par_end(0), isLastPar(false),
+ par_begin(0), par_end(0), lastid(-1), lastpos(-1), isLastPar(false),
dryrun(false), pass_thru(false),
html_disable_captions(false), html_in_par(false),
html_make_pars(true), for_toc(false), includeall(false)
*/
mutable pit_type par_end;
+ /// Id of the last paragraph before an inset
+ mutable int lastid;
+
+ /// Last position in the last paragraph before an inset
+ mutable int lastpos;
+
/// is this the last paragraph in the current buffer/inset?
bool isLastPar;
int prev_rows = os.texrow().rows();
try {
+ runparams.lastid = id_;
+ runparams.lastpos = i;
inset->latex(os, runparams);
} catch (EncodingException & e) {
// add location information and throw again.
}
}
- os << "%\n";
+ os << safebreakln;
+ if (runparams.lastid != -1)
+ os.texrow().start(runparams.lastid, runparams.lastpos);
+
// Adapt to column/text width correctly also if paragraphs indented:
if (stdwidth)
os << "\\noindent";
// Force \begin{<floatname>} to appear in a new line.
os << breakln << "\\begin{" << from_ascii(tmptype) << '}';
+ if (runparams.lastid != -1)
+ os.texrow().start(runparams.lastid, runparams.lastpos);
// We only output placement if different from the def_placement.
// sidewaysfloats always use their own page
if (!placement.empty() && !params_.sideways)
// footnotes in titling commands like \title have moving arguments
runparams.moving_arg |= runparams_in.intitle;
+ os << safebreakln;
+ if (runparams.lastid != -1)
+ os.texrow().start(runparams.lastid, runparams.lastpos);
+
// in titling commands, \thanks should be used instead of \footnote.
// some classes (e.g. memoir) do not understand \footnote.
if (runparams_in.intitle)
- os << "%\n\\thanks{";
+ os << "\\thanks{";
else
- os << "%\n\\footnote{";
+ os << "\\footnote{";
InsetText::latex(os, runparams);
os << "%\n}";
//+ first the opening preamble +
//+---------------------------------------------------------------------
+ os << safebreakln;
+ if (runparams.lastid != -1)
+ os.texrow().start(runparams.lastid, runparams.lastpos);
+
if (rotate)
os << "\\begin{sideways}\n";
os << breakln;
else
os << safebreakln;
+ if (runparams.lastid != -1)
+ os.texrow().start(runparams.lastid,
+ runparams.lastpos);
os << "\\begin{" << from_utf8(il.latexname()) << "}\n";
if (!il.latexparam().empty())
os << from_utf8(il.latexparam());
wi.canBreakLine(os.canBreakLine());
write(wi);
os.canBreakLine(wi.canBreakLine());
- os.texrow().newlines(wi.line());
+
+ int lf = wi.line();
+ if (lf > 0 && runparams.lastid != -1) {
+ --lf;
+ os.texrow().newline();
+ os.texrow().start(runparams.lastid, runparams.lastpos);
+ }
+ os.texrow().newlines(lf);
}