]> git.lyx.org Git - features.git/blobdiff - src/mathed/InsetMathScript.cpp
Overhaul (no)limits support
[features.git] / src / mathed / InsetMathScript.cpp
index d88025b0b53f4415b6506ffdbd6c96b6a5f3d311..15ed90f131c7101114ef48493c617c42be16ffc1 100644 (file)
@@ -253,6 +253,23 @@ int InsetMathScript::nker(BufferView const * bv) const
 }
 
 
+Limits InsetMathScript::limits() const
+{
+       if (nuc().empty())
+               return AUTO_LIMITS;
+       else
+               // only the limits status of the last element counts
+               return nuc().back()->limits();
+}
+
+
+void InsetMathScript::limits(Limits lim)
+{
+       if (!nuc().empty())
+               nuc().back()->limits(lim);
+}
+
+
 MathClass InsetMathScript::mathClass() const
 {
        // FIXME: this is a hack, since the class will not be correct if
@@ -370,13 +387,12 @@ void InsetMathScript::drawT(TextPainter & pain, int x, int y) const
 
 bool InsetMathScript::hasLimits(FontInfo const & font) const
 {
-       if (font.style() != DISPLAY_STYLE)
-               return false;
        if (nuc().empty())
                return false;
 
        Limits const lim = nuc().back()->limits() == AUTO_LIMITS
-               ? nuc().back()->defaultLimits() : nuc().back()->limits();
+               ? nuc().back()->defaultLimits(font.style() == DISPLAY_STYLE)
+               : nuc().back()->limits();
        LASSERT(lim != AUTO_LIMITS, return false);
        return lim == LIMITS;
 }