commit 78aed77c3d90b6fc72c59c74937ece2e8bc8356d
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Sun Apr 15 12:31:27 2018 +0200

    needsCProtection: consider LaTeXType "none"
---
 src/insets/InsetText.cpp |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index 4c560f4..e65f7e9 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -1091,8 +1091,9 @@ bool InsetText::needsCProtection() const
        if (!getLayout().needsCProtect())
                return false;
 
-       // Environments need cprotection regardless the content
-       if (getLayout().latextype() == InsetLayout::ENVIRONMENT)
+       // Environments and "no latex" types (e.g., knitr chunks)
+       // need cprotection regardless the content
+       if (getLayout().latextype() != InsetLayout::COMMAND)
                return true;
 
        // Commands need cprotection if they contain specific chars

Reply via email to