]> git.lyx.org Git - features.git/blobdiff - src/mathed/math_charinset.C
new parser
[features.git] / src / mathed / math_charinset.C
index 7227fc004cb0e0f8447e747c12f3f46a211a3f38..bee9ec01bd57d9dcffe17a6200205a6ca4424fed 100644 (file)
@@ -2,6 +2,8 @@
 #pragma implementation
 #endif
 
+#include <cctype>
+
 #include "math_charinset.h"
 #include "LColor.h"
 #include "Painter.h"
 #include "debug.h"
 
 
+MathCharInset::MathCharInset(char c)
+       : char_(c), code_(nativeCode(c))
+{
+       if (isalpha(c))
+               code_ = LM_TC_VAR;
+}
+
+
 MathCharInset::MathCharInset(char c, MathTextCodes t)
-       : char_(c), code_(t)
+       : char_(c), code_((t == LM_TC_MIN) ? nativeCode(c) : t)
 {}
 
 
+MathTextCodes MathCharInset::nativeCode(char c) const
+{
+       if (isalpha(c))
+               return LM_TC_VAR;
+       return LM_TC_MIN;
+}
+
+
 MathInset * MathCharInset::clone() const
 {   
        return new MathCharInset(*this);