mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-13 06:20:28 +00:00
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:
parent
dde506924c
commit
f997928d57
@ -743,9 +743,9 @@ void InsetMathGrid::addCol(col_type newcol)
|
|||||||
|
|
||||||
for (row_type row = 0; row < nr; ++row)
|
for (row_type row = 0; row < nr; ++row)
|
||||||
for (col_type col = 0; col < nc; ++col) {
|
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];
|
= cells_[row * nc + col];
|
||||||
new_cellinfo[row * (nc + 1) + col + (col > newcol)]
|
new_cellinfo[row * (nc + 1) + col + (col >= newcol)]
|
||||||
= cellinfo_[row * nc + col];
|
= cellinfo_[row * nc + col];
|
||||||
}
|
}
|
||||||
swap(cells_, new_cells);
|
swap(cells_, new_cells);
|
||||||
|
@ -709,7 +709,7 @@ void InsetMathHull::splitTo3Cols()
|
|||||||
BOOST_ASSERT(ncols() < 3);
|
BOOST_ASSERT(ncols() < 3);
|
||||||
if (ncols() < 2)
|
if (ncols() < 2)
|
||||||
splitTo2Cols();
|
splitTo2Cols();
|
||||||
InsetMathGrid::addCol(1);
|
InsetMathGrid::addCol(2);
|
||||||
for (row_type row = 0; row < nrows(); ++row) {
|
for (row_type row = 0; row < nrows(); ++row) {
|
||||||
idx_type const i = 3 * row + 1;
|
idx_type const i = 3 * row + 1;
|
||||||
if (cell(i).size()) {
|
if (cell(i).size()) {
|
||||||
@ -731,7 +731,7 @@ void InsetMathHull::changeCols(col_type cols)
|
|||||||
else {
|
else {
|
||||||
splitTo3Cols();
|
splitTo3Cols();
|
||||||
while (ncols() < cols)
|
while (ncols() < cols)
|
||||||
InsetMathGrid::addCol(ncols() - 1);
|
InsetMathGrid::addCol(ncols());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ bool addCol(InsetMathGrid & grid, InsetMathGrid::col_type & cellcol)
|
|||||||
++cellcol;
|
++cellcol;
|
||||||
if (cellcol == grid.ncols()) {
|
if (cellcol == grid.ncols()) {
|
||||||
//lyxerr << "adding column " << cellcol << endl;
|
//lyxerr << "adding column " << cellcol << endl;
|
||||||
grid.addCol(cellcol - 1);
|
grid.addCol(cellcol);
|
||||||
if (cellcol == grid.ncols()) {
|
if (cellcol == grid.ncols()) {
|
||||||
// We can't add a column to this grid, so let's
|
// We can't add a column to this grid, so let's
|
||||||
// append the content of this cell to the previous
|
// append the content of this cell to the previous
|
||||||
|
Loading…
Reference in New Issue
Block a user