]> git.lyx.org Git - features.git/commitdiff
fix bug 580: reading of some ill-formed tables
authorMartin Vermeer <martin.vermeer@hut.fi>
Fri, 10 Aug 2007 08:05:10 +0000 (08:05 +0000)
committerMartin Vermeer <martin.vermeer@hut.fi>
Fri, 10 Aug 2007 08:05:10 +0000 (08:05 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19390 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetTabular.cpp

index 3cc40d46bddafb0bf890d318e715b3f020c51c50..50b743a3d90237a3cf33c8a95b225619030229f2 100644 (file)
@@ -749,15 +749,23 @@ void Tabular::set_row_column_number_info()
        numberofcells = 0;
        for (row_type row = 0; row < rows_; ++row) {
                for (col_type column = 0; column < columns_; ++column) {
        numberofcells = 0;
        for (row_type row = 0; row < rows_; ++row) {
                for (col_type column = 0; column < columns_; ++column) {
+
+                       // If on its left is either the edge, or a normal cell,
+                       // then this cannot be a non-begin multicol cell.
+                       // Clean up as well as we can:
+                       if (cell_info[row][column].multicolumn
+                                  == CELL_PART_OF_MULTICOLUMN) {
+                               if (column == 0 || 
+                                   cell_info[row][column - 1]
+                                       .multicolumn == CELL_NORMAL)
+                                       cell_info[row][column].multicolumn = 
+                                               CELL_NORMAL;
+                       }
+                       // Count only non-multicol cells plus begin multicol
+                       // cells, ignore non-begin multicol cells:
                        if (cell_info[row][column].multicolumn
                                != Tabular::CELL_PART_OF_MULTICOLUMN)
                                ++numberofcells;
                        if (cell_info[row][column].multicolumn
                                != Tabular::CELL_PART_OF_MULTICOLUMN)
                                ++numberofcells;
-                       if (numberofcells == 0)
-                               // FIXME: Is this intended?
-                               cell_info[row][column].cellno = npos;
-                       else
-                               cell_info[row][column].cellno =
-                                       numberofcells - 1;
                }
        }
 
                }
        }