]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_inset.C
Andreas' patch to prevent crash on click on previewd inset
[lyx.git] / src / mathed / math_inset.C
index a8ce515c52a308770a62787ad26b4834a296f60f..6ed6a784e5d2dc1a607a6eec3d890e864a673c1a 100644 (file)
 #include "math_mathmlstream.h"
 #include "debug.h"
 
+#include "support/lstrings.h"
+
 using std::string;
 using std::ostream;
 using std::endl;
 
 
-MathArray dummyCell;
-
 MathArray & MathInset::cell(idx_type)
 {
+       static MathArray dummyCell;
        lyxerr << "I don't have a cell 1" << endl;
        return dummyCell;
 }
@@ -32,16 +33,12 @@ MathArray & MathInset::cell(idx_type)
 
 MathArray const & MathInset::cell(idx_type) const
 {
+       static MathArray dummyCell;
        lyxerr << "I don't have a cell 2" << endl;
        return dummyCell;
 }
 
 
-void MathInset::substitute(MathMacro const &)
-{}
-
-
-
 void MathInset::dump() const
 {
        lyxerr << "---------------------------------------------" << endl;
@@ -70,8 +67,12 @@ void MathInset::drawT(TextPainter &, int, int) const
 
 void MathInset::write(WriteStream & os) const
 {
-       os << '\\' << name().c_str();
-       os.pendingSpace(true);
+       string const s = name();
+       os << '\\' << s.c_str();
+       // We need an extra ' ' unless this is a single-char-non-ASCII name
+       // or anything non-ASCII follows
+       if (s.size() != 1 || isalpha(s[0]))
+               os.pendingSpace(true);
 }
 
 
@@ -118,7 +119,7 @@ void MathInset::mathmlize(MathMLStream & os) const
 
 string const & MathInset::getType() const
 {
-       static string const t("none");
+       static string const t = "none";
        return t;
 }
 
@@ -135,9 +136,3 @@ ostream & operator<<(ostream & os, MathAtom const & at)
        at->write(wi);
        return os;
 }
-
-
-string MathInset::fileInsetLabel() const
-{
-       return "Formula";
-}