From f479c5e8c74a1057e7f000500280741a2282e843 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Fri, 4 May 2018 11:56:42 +0200 Subject: [PATCH] cprotect include inset We \cprotect them in fragile context. This allows \input, \include as well as \verbatiminput and \lstinputlisting in sections etc. They still don't work in titling (#2528) --- src/insets/InsetInclude.cpp | 7 +++++++ src/insets/InsetInclude.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index fd673327d3..2d91f62bd2 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -236,6 +236,13 @@ bool InsetInclude::isCompatibleCommand(string const & s) } +bool InsetInclude::needsCProtection(bool const /*maintext*/, bool const fragile) const +{ + // We need to \cprotect all types in fragile context + return fragile; +} + + void InsetInclude::doDispatch(Cursor & cur, FuncRequest & cmd) { switch (cmd.action()) { diff --git a/src/insets/InsetInclude.h b/src/insets/InsetInclude.h index 18329fe6d9..9ecaf42e7e 100644 --- a/src/insets/InsetInclude.h +++ b/src/insets/InsetInclude.h @@ -117,6 +117,9 @@ public: static std::string defaultCommand() { return "include"; } /// static bool isCompatibleCommand(std::string const & s); + /// + bool needsCProtection(bool const maintext = false, + bool const fragile = false) const; //@} protected: -- 2.39.5