commit 00e00b32fd1df4e3c90a63ff067400f0f7153dee
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Mon Apr 30 09:53:14 2018 +0200

    cprotect: don't consider content in Notes, deactivated branches etc.
---
 src/insets/InsetText.cpp |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index f6f6669..0cff7ce 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -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] = {

Reply via email to