]> git.lyx.org Git - features.git/blobdiff - src/mathed/InsetMathNest.cpp
Unicode symbols entered or pasted in math are wrapped in \text{} by default.
[features.git] / src / mathed / InsetMathNest.cpp
index 4f3656a7364e4b6dee7c582fe3cf3f6ec8187d01..fadc82cccf1d9d5609e652a36eb859bb6073f42d 100644 (file)
@@ -16,6 +16,7 @@
 #include "InsetMathBig.h"
 #include "InsetMathBox.h"
 #include "InsetMathBrace.h"
+#include "InsetMathChar.h"
 #include "InsetMathColor.h"
 #include "InsetMathComment.h"
 #include "InsetMathDelim.h"
@@ -42,6 +43,7 @@
 #include "Cursor.h"
 #include "CutAndPaste.h"
 #include "DispatchResult.h"
+#include "Encoding.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
 #include "LyXFunc.h"
@@ -514,7 +516,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
 {
        //lyxerr << "InsetMathNest: request: " << cmd << endl;
 
-       Parse::flags parseflg = Parse::QUIET;
+       Parse::flags parseflg = Parse::QUIET | Parse::USETEXT;
 
        switch (cmd.action) {
 
@@ -1615,6 +1617,13 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
                        cur.niceInsert(createInsetMath("sim"));
                        return true;
                }
+               if (c >= 0x80 && !Encodings::isMathAlpha(c)) {
+                       MathAtom at = createInsetMath("text");
+                       at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
+                       cur.niceInsert(at);
+                       cur.posForward();
+                       return true;
+               }
        } else {
                if (c == '^') {
                        cur.niceInsert(createInsetMath("textasciicircum"));