Off-by-one error addCol()

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20947 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2007-10-13 15:48:22 +00:00
parent dde506924c
commit f997928d57
3 changed files with 5 additions and 5 deletions

View File

@ -743,9 +743,9 @@ void InsetMathGrid::addCol(col_type newcol)
for (row_type row = 0; row < nr; ++row)
for (col_type col = 0; col < nc; ++col) {
new_cells[row * (nc + 1) + col + (col > newcol)]
new_cells[row * (nc + 1) + col + (col >= newcol)]
= cells_[row * nc + col];
new_cellinfo[row * (nc + 1) + col + (col > newcol)]
new_cellinfo[row * (nc + 1) + col + (col >= newcol)]
= cellinfo_[row * nc + col];
}
swap(cells_, new_cells);

View File

@ -709,7 +709,7 @@ void InsetMathHull::splitTo3Cols()
BOOST_ASSERT(ncols() < 3);
if (ncols() < 2)
splitTo2Cols();
InsetMathGrid::addCol(1);
InsetMathGrid::addCol(2);
for (row_type row = 0; row < nrows(); ++row) {
idx_type const i = 3 * row + 1;
if (cell(i).size()) {
@ -731,7 +731,7 @@ void InsetMathHull::changeCols(col_type cols)
else {
splitTo3Cols();
while (ncols() < cols)
InsetMathGrid::addCol(ncols() - 1);
InsetMathGrid::addCol(ncols());
}
return;
}

View File

@ -150,7 +150,7 @@ bool addCol(InsetMathGrid & grid, InsetMathGrid::col_type & cellcol)
++cellcol;
if (cellcol == grid.ncols()) {
//lyxerr << "adding column " << cellcol << endl;
grid.addCol(cellcol - 1);
grid.addCol(cellcol);
if (cellcol == grid.ncols()) {
// We can't add a column to this grid, so let's
// append the content of this cell to the previous