]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_parser.C
Fix event loop to no longer eat CPU
[lyx.git] / src / mathed / math_parser.C
index 05d57e8d175bd01f13c67f72b0ed89edfba871fb..a050a512cc55c5cccaddb4fdefd1d4c384768359 100644 (file)
@@ -181,7 +181,11 @@ void delEmptyLastRow(MathGridInset & grid)
                if (!grid.cell(grid.index(row, col)).empty())
                        return;
        }
-       grid.delRow(row + 1);
+       // Copy the row information of the empty row (which would contain the
+       // last hline in the example above) to the dummy row and delete the
+       // empty row.
+       grid.rowinfo(row + 1) = grid.rowinfo(row);
+       grid.delRow(row);
 }
 
 
@@ -935,8 +939,14 @@ void Parser::parse1(MathGridInset & grid, unsigned flags,
                                              environments_.back() + "}'");
                                else {
                                        environments_.pop_back();
-                                       if (name == "array" ||
-                                           name == "subarray")
+                                       // Delete empty last row in matrix
+                                       // like insets.
+                                       // If you abuse MathGridInset for
+                                       // non-matrix like structures you
+                                       // probably need to refine this test.
+                                       // Right now we only have to test for
+                                       // single line hull insets.
+                                       if (grid.nrows() > 1)
                                                delEmptyLastRow(grid);
                                        return;
                                }
@@ -1089,8 +1099,14 @@ void Parser::parse1(MathGridInset & grid, unsigned flags,
                        }
 
                        else if (name == "split" || name == "cases" ||
-                                name == "gathered" || name == "aligned" ||
-                                name == "alignedat") {
+                                name == "gathered" || name == "aligned") {
+                               cell->push_back(createMathInset(name));
+                               parse2(cell->back(), FLAG_END, mode, false);
+                       }
+
+                       else if (name == "alignedat") {
+                               // ignore this for a while
+                               getArg('{', '}');
                                cell->push_back(createMathInset(name));
                                parse2(cell->back(), FLAG_END, mode, false);
                        }
@@ -1187,6 +1203,7 @@ void Parser::parse1(MathGridInset & grid, unsigned flags,
                }
 
                else if (t.cs() == "label") {
+                       // FIXME: This is swallowed in inline formulas
                        string label = parse_verbatim_item();
                        MathArray ar;
                        asArray(label, ar);