On Sun, Apr 21, 2019 at 04:38:20PM +0200, Juergen Spitzmueller wrote: > commit c9432ccbbc2ec0029d9ac59ed8da126f4a02a910 > Author: Juergen Spitzmueller <sp...@lyx.org> > Date: Sun Apr 21 16:44:29 2019 +0200 > > \cprotect some content in captions > > Fixes: #6243 > --- > src/Paragraph.cpp | 29 ++++++++++++++++++++++++++--- > src/insets/InsetText.cpp | 11 ++++++----- > src/insets/InsetText.h | 2 +- > 3 files changed, 33 insertions(+), 9 deletions(-)
Starting with this commit, the attached document loads the cprotect package but cprotect command is never used. See comment below the code. > > diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp > index a41fe67..59cfa64 100644 > --- a/src/Paragraph.cpp > +++ b/src/Paragraph.cpp > @@ -1647,6 +1647,8 @@ void Paragraph::validate(LaTeXFeatures & features) const > d->validate(features); > bool fragile = features.runparams().moving_arg; > fragile |= layout().needprotect; > + if (inInset().getLayout().isNeedProtect()) > + fragile = true; > if (needsCProtection(fragile)) > features.require("cprotect"); > } > @@ -3435,10 +3437,31 @@ bool Paragraph::needsCProtection(bool const fragile) > const > } > > // now check whether we have insets that need cprotection > - pos_type size = d->text_.size(); > - for (pos_type i = 0; i < size; ++i) > - if (isInset(i) && getInset(i)->needsCProtection(maintext, > fragile)) > + pos_type size = pos_type(d->text_.size()); > + for (pos_type i = 0; i < size; ++i) { > + if (!isInset(i)) > + continue; > + Inset const * ins = getInset(i); > + if (ins->needsCProtection(maintext, fragile)) > + return true; > + if (ins->getLayout().latextype() == InsetLayout::ENVIRONMENT) > + // Environments need cprotection regardless the content > + return true; This is the "return true" that seems to happen with the document. Scott
unnecessary-cprotect.23.lyx
Description: application/lyx
signature.asc
Description: PGP signature
-- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel