deleted not only for "array" but also for all inner-hull grid types.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34752
a592a061-630c-0410-9148-
cb99ea01b6c8
- * Check wether the last row is empty and remove it if yes.
+ * Check whether the last row is empty and remove it if yes.
* Otherwise the following code
* \verbatim
\begin{array}{|c|c|}
* Otherwise the following code
* \verbatim
\begin{array}{|c|c|}
* \endverbatim
* will result in a grid with 3 rows (+ the dummy row that is always present),
* because the last '\\' opens a new row.
* \endverbatim
* will result in a grid with 3 rows (+ the dummy row that is always present),
* because the last '\\' opens a new row.
+ * Note that this is only needed for inner-hull grid types, such as array
+ * or aligned, but not for outer-hull grid types, such as eqnarray or align.
*/
void delEmptyLastRow(InsetMathGrid & grid)
{
*/
void delEmptyLastRow(InsetMathGrid & grid)
{
+/*!
+ * Tell whether the environment name corresponds to an inner-hull grid type.
+ */
+bool innerHull(docstring const & name)
+{
+ return name == "array" || name == "cases" || name == "aligned"
+ || name == "alignedat" || name == "gathered" || name == "split";
+}
+
+
// These are TeX's catcodes
enum CatCode {
catEscape, // 0 backslash
// These are TeX's catcodes
enum CatCode {
catEscape, // 0 backslash
// probably need to refine this test.
// Right now we only have to test for
// single line hull insets.
// probably need to refine this test.
// Right now we only have to test for
// single line hull insets.
- if (grid.nrows() > 1 && name == "array")
+ if (grid.nrows() > 1 && innerHull(name))
delEmptyLastRow(grid);
return success_;
}
delEmptyLastRow(grid);
return success_;
}