]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathUnderset.cpp
Assure correct spacing of colored items in mathed
[lyx.git] / src / mathed / InsetMathUnderset.cpp
index 559889073b9811944d86debdfa8f77c5bec37787..2c38e3065f2a2f5d054f0fbfacc870d5c796ffe8 100644 (file)
@@ -19,6 +19,7 @@
 #include "LaTeXFeatures.h"
 #include "MetricsInfo.h"
 
+#include "support/lassert.h"
 
 using namespace std;
 
@@ -35,7 +36,7 @@ void InsetMathUnderset::metrics(MetricsInfo & mi, Dimension & dim) const
        Changer dummy2 = mi.base.changeEnsureMath();
        Dimension dim0;
        cell(0).metrics(mi, dim0);
-       Changer dummy = mi.base.changeFrac();
+       Changer dummy = mi.base.changeScript();
        Dimension dim1;
        cell(1).metrics(mi, dim1);
        dim.wid = max(dim1.width(), dim0.width()) + 4;
@@ -53,11 +54,29 @@ void InsetMathUnderset::draw(PainterInfo & pi, int x, int y) const
        int m  = x + dim.wid / 2;
        int yo = y + dim0.descent() + dim1.ascent() + 1;
        cell(0).draw(pi, m - dim0.width() / 2, y);
-       Changer dummy = pi.base.changeFrac();
+       Changer dummy = pi.base.changeScript();
        cell(1).draw(pi, m - dim1.width() / 2, yo);
 }
 
 
+bool InsetMathUnderset::idxFirst(Cursor & cur) const
+{
+       LASSERT(&cur.inset() == this, return false);
+       cur.idx() = 0;
+       cur.pos() = 0;
+       return true;
+}
+
+
+bool InsetMathUnderset::idxLast(Cursor & cur) const
+{
+       LASSERT(&cur.inset() == this, return false);
+       cur.idx() = 0;
+       cur.pos() = cur.lastpos();
+       return true;
+}
+
+
 void InsetMathUnderset::write(WriteStream & os) const
 {
        MathEnsurer ensurer(os);
@@ -75,7 +94,9 @@ void InsetMathUnderset::normalize(NormalStream & os) const
 
 void InsetMathUnderset::mathmlize(MathStream & ms) const
 {
-       ms << "<munder accent='false'>" << cell(0) << cell(1) << "</munder>";
+       ms << "<" << from_ascii(ms.namespacedTag("munder")) << " accent='false'>"
+          << cell(0) << cell(1)
+          << "</" << from_ascii(ms.namespacedTag("munder")) << ">";
 }