mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 06:19:36 +00:00
When an error occurs, don't highlight more than necessary.
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
This commit is contained in:
parent
873704f865
commit
6d425078a7
@ -27,7 +27,7 @@ OutputParams::OutputParams(Encoding const * enc)
|
||||
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)
|
||||
|
@ -218,6 +218,12 @@ public:
|
||||
*/
|
||||
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;
|
||||
|
||||
|
@ -1117,6 +1117,8 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
|
||||
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.
|
||||
|
@ -271,7 +271,10 @@ void InsetBox::latex(otexstream & os, OutputParams const & runparams) const
|
||||
}
|
||||
}
|
||||
|
||||
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";
|
||||
|
@ -374,6 +374,8 @@ void InsetFloat::latex(otexstream & os, OutputParams const & runparams_in) const
|
||||
|
||||
// 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)
|
||||
|
@ -90,12 +90,16 @@ void InsetFoot::latex(otexstream & os, OutputParams const & runparams_in) const
|
||||
// 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}";
|
||||
|
@ -2563,6 +2563,10 @@ void Tabular::latex(otexstream & os, OutputParams const & runparams) const
|
||||
//+ first the opening preamble +
|
||||
//+---------------------------------------------------------------------
|
||||
|
||||
os << safebreakln;
|
||||
if (runparams.lastid != -1)
|
||||
os.texrow().start(runparams.lastid, runparams.lastpos);
|
||||
|
||||
if (rotate)
|
||||
os << "\\begin{sideways}\n";
|
||||
|
||||
|
@ -391,6 +391,9 @@ void InsetText::latex(otexstream & os, OutputParams const & runparams) const
|
||||
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());
|
||||
|
@ -402,7 +402,14 @@ void InsetMathNest::latex(otexstream & os, OutputParams const & runparams) const
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user