From 00e00b32fd1df4e3c90a63ff067400f0f7153dee Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Mon, 30 Apr 2018 09:53:14 +0200 Subject: [PATCH] cprotect: don't consider content in Notes, deactivated branches etc. --- src/insets/InsetText.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index f6f6669c4a..0cff7cee0a 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] = { -- 2.39.2