]> git.lyx.org Git - features.git/commitdiff
Fix consecutive merging of tabular cells
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 24 Mar 2015 09:50:51 +0000 (10:50 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 24 Mar 2015 09:50:51 +0000 (10:50 +0100)
This is a bug reported and fixed by Edwin Leuven.

Here is how Edwin described it in his inimitable minimalist style:
  first i merge the top-left two cells in a small, say 3x3, table

  if i then merge this multicolumn cell with the remaining cell in the first row
  my table ends up all bonkers

src/insets/InsetTabular.cpp

index 8f86888df556fe9b2b67affa9c87a53275ba6ab8..d39cf7f2638e8907095c3c76e5ec74fb7a03b2fb 100644 (file)
@@ -1688,7 +1688,8 @@ Tabular::idx_type Tabular::setMultiColumn(idx_type cell, idx_type number,
                cs.alignment = column_info[col].alignment;
        setRightLine(cell, right_border);
 
-       for (idx_type i = 1; i < number; ++i) {
+       idx_type lastcell = cellIndex(row, col + number - 1);
+       for (idx_type i = 1; i < lastcell - cell + 1; ++i) {
                CellData & cs1 = cellInfo(cell + i);
                cs1.multicolumn = CELL_PART_OF_MULTICOLUMN;
                cs.inset->appendParagraphs(cs1.inset->paragraphs());