]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathParser.cpp
A little cleanup of the layout files.
[lyx.git] / src / mathed / MathParser.cpp
index 757458cc88329a83cafe70db7ba35576578675b9..36be12c2ec94a29a5c4508013c7016e45af82b96 100644 (file)
@@ -46,6 +46,7 @@ following hack as starting point to write some macros:
 #include "InsetMathColor.h"
 #include "InsetMathComment.h"
 #include "InsetMathDelim.h"
+#include "InsetMathEnsureMath.h"
 #include "InsetMathEnv.h"
 #include "InsetMathFrac.h"
 #include "InsetMathKern.h"
@@ -804,8 +805,14 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
                                } else {
                                        // simple $...$  stuff
                                        putback();
-                                       cell->push_back(MathAtom(new InsetMathHull(hullSimple)));
-                                       parse2(cell->back(), FLAG_SIMPLE, InsetMath::MATH_MODE, false);
+                                       if (mode == InsetMath::UNDECIDED_MODE) {
+                                               cell->push_back(MathAtom(new InsetMathHull(hullSimple)));
+                                               parse2(cell->back(), FLAG_SIMPLE, InsetMath::MATH_MODE, false);
+                                       } else {
+                                               // Don't create nested math hulls (bug #5392)
+                                               cell->push_back(MathAtom(new InsetMathEnsureMath));
+                                               parse(cell->back().nucleus()->cell(0), FLAG_SIMPLE, InsetMath::MATH_MODE);
+                                       }
                                }
                        }