cprotect: don't consider content in Notes, deactivated branches etc.

This commit is contained in:
Juergen Spitzmueller 2018-04-30 09:53:14 +02:00
parent 16dc796a47
commit 00e00b32fd

View File

@ -1090,7 +1090,7 @@ bool InsetText::needsCProtection(bool const maintext, bool const fragile) const
{
// Nested cprotect content needs \cprotect
// on each level
if (hasCProtectContent(fragile))
if (producesOutput() && hasCProtectContent(fragile))
return true;
// Environments generally need cprotection in fragile context
@ -1105,6 +1105,11 @@ bool InsetText::needsCProtection(bool const maintext, bool const fragile) const
if (!maintext && getLayout().latextype() != InsetLayout::COMMAND)
return true;
// If the inset does not produce output (e.g. Note or Branch),
// we can ignore the contained paragraphs
if (!producesOutput())
return false;
// Commands need cprotection if they contain specific chars
int const nchars_escape = 9;
static char_type const chars_escape[nchars_escape] = {