]> git.lyx.org Git - lyx.git/blobdiff - src/Paragraph.cpp
Const.
[lyx.git] / src / Paragraph.cpp
index 7f1bf4cca2bdd051c3397595d2bd2fb870458bed..dc41fb9e965a48d7784f21333296595a54279ae5 100644 (file)
@@ -3449,8 +3449,13 @@ bool Paragraph::isHardHyphenOrApostrophe(pos_type pos) const
 
 bool Paragraph::needsCProtection() const
 {
-       // first check the layout of the paragraph
-       if (layout().needcprotect) {
+       // first check the layout of the paragraph, but only in insets
+       InsetText const * textinset = inInset().asInsetText();
+       bool const maintext = textinset
+               ? textinset->text().isMainText()
+               : false;
+
+       if (!maintext && layout().needcprotect) {
                // Environments need cprotection regardless the content
                if (layout().latextype == LATEX_ENVIRONMENT)
                        return true;
@@ -3470,7 +3475,7 @@ bool Paragraph::needsCProtection() const
        // now check whether we have insets that need cprotection
        pos_type size = d->text_.size();
        for (pos_type i = 0; i < size; ++i)
-               if (isInset(i) && getInset(i)->needsCProtection())
+               if (isInset(i) && getInset(i)->needsCProtection(maintext))
                        return true;
 
        return false;