]> git.lyx.org Git - features.git/blobdiff - src/mathed/InsetMathNest.cpp
Fix bug #1435. Now Ctrl-m enters math mode when in text-in-math mode,
[features.git] / src / mathed / InsetMathNest.cpp
index a55c0551ed8aed3500e2b9804f73e32d0d7160dd..8c4bc3b089ac74feb1d74e01badb840ecc97dc39 100644 (file)
@@ -20,6 +20,7 @@
 #include "InsetMathColor.h"
 #include "InsetMathComment.h"
 #include "InsetMathDelim.h"
+#include "InsetMathEnsureMath.h"
 #include "InsetMathHull.h"
 #include "InsetMathRef.h"
 #include "InsetMathScript.h"
@@ -954,7 +955,10 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                docstring const save_selection = grabAndEraseSelection(cur);
                selClearOrDel(cur);
                //cur.plainInsert(MathAtom(new InsetMathMBox(cur.bv())));
-               cur.plainInsert(MathAtom(new InsetMathBox(from_ascii("mbox"))));
+               if (currentMode() == Inset::TEXT_MODE)
+                       cur.plainInsert(MathAtom(new InsetMathEnsureMath));
+               else
+                       cur.plainInsert(MathAtom(new InsetMathBox(from_ascii("mbox"))));
                cur.posBackward();
                cur.pushBackward(*cur.nextInset());
                cur.niceInsert(save_selection);