]> git.lyx.org Git - features.git/blobdiff - src/mathed/MathParser.cpp
Unicode symbols entered or pasted in math are wrapped in \text{} by default.
[features.git] / src / mathed / MathParser.cpp
index 851828c9481523126bb0af4c9bb43224040b5c6c..362b67193e3025d36588ee59b0957e5502a32718 100644 (file)
@@ -907,8 +907,22 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
                        return success_;
                }
 
-               else if (t.cat() == catOther)
-                       cell->push_back(MathAtom(new InsetMathChar(t.character())));
+               else if (t.cat() == catOther) {
+                       char_type c = t.character();
+                       if (c < 0x80 || mode_ & Parse::VERBATIM
+                           || !(mode_ & Parse::USETEXT)) {
+                               cell->push_back(MathAtom(new InsetMathChar(c)));
+                       } else {
+                               MathAtom at = createInsetMath("text");
+                               at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(t.character())));
+                               while (nextToken().cat() == catOther
+                                      && nextToken().character() >= 0x80) {
+                                       c = getToken().character();
+                                       at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
+                               }
+                               cell->push_back(at);
+                       }
+               }
 
                else if (t.cat() == catComment) {
                        docstring s;