]> git.lyx.org Git - features.git/commitdiff
cprotect: don't consider content in Notes, deactivated branches etc.
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 30 Apr 2018 07:53:14 +0000 (09:53 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 30 Apr 2018 07:53:14 +0000 (09:53 +0200)
src/insets/InsetText.cpp

index f6f6669c4aa7fb424c157087ba2898bee4550f97..0cff7cee0a0a01186d39eec4fbb2138166846f97 100644 (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] = {