]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathParser.cpp
Fix bug #6246: InsetMathKern is broken
[lyx.git] / src / mathed / MathParser.cpp
index 36be12c2ec94a29a5c4508013c7016e45af82b96..d259a19332dacb0b093586952c734640cd2a2e3e 100644 (file)
@@ -1552,17 +1552,24 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
                else if (t.cs() == "kern") {
                        // FIXME: A hack...
                        docstring s;
+                       int num_tokens = 0;
                        while (true) {
                                Token const & t = getToken();
+                               ++num_tokens;
                                if (!good()) {
-                                       putback();
+                                       s.clear();
+                                       while (num_tokens--)
+                                               putback();
                                        break;
                                }
                                s += t.character();
                                if (isValidLength(to_utf8(s)))
                                        break;
                        }
-                       cell->push_back(MathAtom(new InsetMathKern(s)));
+                       if (s.empty())
+                               cell->push_back(MathAtom(new InsetMathKern));
+                       else
+                               cell->push_back(MathAtom(new InsetMathKern(s)));
                }
 
                else if (t.cs() == "label") {