From: Juergen Spitzmueller Date: Fri, 4 May 2018 09:56:42 +0000 (+0200) Subject: cprotect include inset X-Git-Tag: lyx-2.4.0dev-acb2ca7b~3498 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=f479c5e8c74a1057e7f000500280741a2282e843;p=features.git 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) --- 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: