]> git.lyx.org Git - features.git/commitdiff
Fine tune the math class of InsetMathScript after a4676712
authorGuillaume Munch <gm@lyx.org>
Thu, 5 Jan 2017 11:03:53 +0000 (12:03 +0100)
committerGuillaume Munch <gm@lyx.org>
Thu, 5 Jan 2017 11:04:35 +0000 (12:04 +0100)
src/mathed/InsetMathScript.cpp

index 22a226d6ad9823446fe42dadb5afe2e2a1dec50c..a4ffd576b03bea104467d878bba6cfdc7543550a 100644 (file)
@@ -276,13 +276,16 @@ int InsetMathScript::nker(BufferView const * bv) const
 MathClass InsetMathScript::mathClass() const
 {
        // FIXME: this is a hack, since the class will not be correct if
-       // the nucleus has several elements.
+       // the nucleus has several elements or if the last element is a math macro
+       // or a macro argument proxy.
        // The correct implementation would require to linearize the nucleus.
        if (nuc().empty())
                return MC_ORD;
-       else
+       else {
                // return the class of last element since this is the one that counts.
-               return nuc().back()->mathClass();
+               MathClass mc = nuc().back()->mathClass();
+               return (mc == MC_UNKNOWN) ? MC_ORD : mc;
+       }
 }