]> git.lyx.org Git - features.git/commitdiff
cprotect include inset
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 4 May 2018 09:56:42 +0000 (11:56 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Fri, 4 May 2018 09:56:42 +0000 (11:56 +0200)
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
src/insets/InsetInclude.h

index fd673327d3ef6412e971533721a7b85c717c1eff..2d91f62bd21fed19cf54b8d13600fb9690f3e60c 100644 (file)
@@ -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()) {
index 18329fe6d9117826e8f62c9eaf2e1b8990123d8f..9ecaf42e7e0eaa97f7bef74304d02bf2a73c01f1 100644 (file)
@@ -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: