]> git.lyx.org Git - features.git/blobdiff - src/Paragraph.cpp
\protect xymatrix in fragile context
[features.git] / src / Paragraph.cpp
index cf2f53a78c6c01e94be88dc0981476b6b31ec8bc..369bda0d7e80e39e4cc47dc55276a3309071618d 100644 (file)
@@ -1240,7 +1240,7 @@ void Paragraph::Private::latexSpecialChar(otexstream & os,
        //       non-standard font encoding. If we are using such a language,
        //       we do not output special T1 chars.
        if (!runparams.inIPA && !running_font.language()->internalFontEncoding()
-           && !runparams.isFullUnicode() && bparams.main_font_encoding() == "T1"
+           && !runparams.isFullUnicode() && runparams.main_fontenc == "T1"
            && latexSpecialT1(c, os, i, column))
                return;
        // NOTE: "fontspec" (non-TeX fonts) sets the font encoding to "TU" (untill 2017 "EU1" or "EU2")
@@ -1532,7 +1532,7 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const
                if (c == 0x0022) {
                        if (features.runparams().isFullUnicode() && bp.useNonTeXFonts)
                                features.require("textquotedblp");
-                       else if (bp.main_font_encoding() != "T1"
+                       else if (features.runparams().main_fontenc != "T1"
                                 || ((&owner_->getFontSettings(bp, i))->language()->internalFontEncoding()))
                                features.require("textquotedbl");
                } else if (ci.textfeature() && contains(ci.textpreamble(), '=')) {
@@ -2269,6 +2269,12 @@ bool Paragraph::isPassThru() const
 }
 
 
+bool Paragraph::parbreakIsNewline() const
+{
+       return inInset().getLayout().parbreakIsNewline() || d->layout_->parbreak_is_newline;
+}
+
+
 bool Paragraph::isPartOfTextSequence() const
 {
        for (pos_type i = 0; i < size(); ++i) {
@@ -4108,22 +4114,18 @@ bool Paragraph::needsCProtection(bool const fragile) const
        }
 
        // now check whether we have insets that need cprotection
-       pos_type size = pos_type(d->text_.size());
-       for (pos_type i = 0; i < size; ++i) {
-               if (!isInset(i))
+       for (auto const & icit : d->insetlist_) {
+               Inset const * ins = icit.inset;
+               if (!ins)
                        continue;
-               Inset const * ins = getInset(i);
                if (ins->needsCProtection(maintext, fragile))
                        return true;
                // Now check math environments
-               InsetMath const * im = getInset(i)->asInsetMath();
+               InsetMath const * im = ins->asInsetMath();
                if (!im || im->cell(0).empty())
                        continue;
                switch(im->cell(0)[0]->lyxCode()) {
-               case MATH_AMSARRAY_CODE:
-               case MATH_SUBSTACK_CODE:
                case MATH_ENV_CODE:
-               case MATH_XYMATRIX_CODE:
                        // these need cprotection
                        return true;
                default:
@@ -4858,7 +4860,7 @@ Language * Paragraph::Private::getSpellLanguage(pos_type const from) const
 void Paragraph::requestSpellCheck(pos_type pos)
 {
        d->requestSpellCheck(pos);
-       if (pos == -1 ) {
+       if (pos == -1) {
                // Also request spellcheck within (text) insets
                for (auto const & insets : insetList()) {
                        if (!insets.inset->asInsetText())