fix append column when cursor is in multicol cell

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23764 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Edwin Leuven 2008-03-15 16:44:00 +00:00
parent cdbebdf093
commit 781c2babeb

View File

@ -681,28 +681,25 @@ void Tabular::copyRow(row_type const row)
void Tabular::appendColumn(idx_type const cell) void Tabular::appendColumn(idx_type const cell)
{ {
col_type const column = cellColumn(cell); col_type const column = cellColumn(cell);
col_type const ncols = columnCount();
column_vector::iterator cit = column_info.begin() + column + 1; column_vector::iterator cit = column_info.begin() + column + 1;
column_info.insert(cit, ColumnData()); column_info.insert(cit, ColumnData());
col_type const ncols = columnCount();
// set the column values of the column before // set the column values of the column before
column_info[column + 1] = column_info[column]; column_info[column + 1] = column_info[column];
BufferParams const & bp = buffer().params();
for (row_type i = 0; i < rowCount(); ++i) { for (row_type i = 0; i < rowCount(); ++i) {
cell_info[i].insert(cell_info[i].begin() + column + 1, CellData(buffer())); cell_info[i].insert(cell_info[i].begin() + column + 1, CellData(buffer()));
col_type c = column + 2;
// care about multicolumns while (c < ncols
if (cell_info[i][column + 1].multicolumn == CELL_BEGIN_OF_MULTICOLUMN) && cell_info[i][c].multicolumn == CELL_PART_OF_MULTICOLUMN) {
cell_info[i][column + 1].multicolumn = CELL_PART_OF_MULTICOLUMN; cell_info[i][c].multicolumn = CELL_NORMAL;
++c;
if (column + 2 >= ncols }
|| cell_info[i][column + 2].multicolumn != CELL_PART_OF_MULTICOLUMN)
cell_info[i][column + 1].multicolumn = Tabular::CELL_NORMAL;
} }
//++column; //++column;
for (row_type i = 0; i < rowCount(); ++i) { for (row_type i = 0; i < rowCount(); ++i) {
cell_info[i][column + 1].inset->clear(); cell_info[i][column + 1].inset->clear();
if (bp.trackChanges) if (buffer().params().trackChanges)
cell_info[i][column + 1].inset->setChange(Change(Change::INSERTED)); cell_info[i][column + 1].inset->setChange(Change(Change::INSERTED));
} }
fixCellNums(); fixCellNums();