From cf96711fc904358f8043b455e3d49719ad70b974 Mon Sep 17 00:00:00 2001 From: Martin Vermeer Date: Fri, 10 Aug 2007 08:05:10 +0000 Subject: [PATCH] fix bug 580: reading of some ill-formed tables git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19390 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetTabular.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 3cc40d46bd..50b743a3d9 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -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) { + + // 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 (numberofcells == 0) - // FIXME: Is this intended? - cell_info[row][column].cellno = npos; - else - cell_info[row][column].cellno = - numberofcells - 1; } }