]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathSpace.cpp
Simplify Changers interface
[lyx.git] / src / mathed / InsetMathSpace.cpp
index 2a3b6f45cb477657a4e988da12b4991e14d0be46..4cf1b944f878d166e0cf7ac4ef95560289e01169 100644 (file)
@@ -21,6 +21,7 @@
 #include "FuncRequest.h"
 #include "FuncStatus.h"
 #include "LaTeXFeatures.h"
+#include "MetricsInfo.h"
 
 #include "insets/InsetSpace.h"
 
@@ -123,9 +124,7 @@ void InsetMathSpace::metrics(MetricsInfo & mi, Dimension & dim) const
        dim.asc = 4;
        dim.des = 0;
        if (space_info[space_].custom)
-               dim.wid = abs(length_.inPixels(
-                               mi.base.textwidth,
-                               mathed_char_width(mi.base.font, 'M')));
+               dim.wid = abs(length_.inPixels(mi.base));
        else
                dim.wid = space_info[space_].width;
 }
@@ -267,7 +266,9 @@ void InsetMathSpace::normalize(NormalStream & os) const
 
 void InsetMathSpace::write(WriteStream & os) const
 {
-       // no MathEnsurer - all kinds work in text and math mode
+       // All kinds work in text and math mode, so simply suspend
+       // writing a possibly pending mode closing brace.
+       MathEnsurer ensurer(os, false);
        if (space_info[space_].escape)
                os << '\\';
        os << space_info[space_].name.c_str();