fix pasting

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3275 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-01-02 13:43:13 +00:00
parent 3bb41590f2
commit 95616fc9b3

View File

@ -124,16 +124,22 @@ struct Selection
} }
void paste(MathCursor & cursor) const void paste(MathCursor & cursor) const
{ {
idx_type idx; if (data_.nargs() == 1) {
MathGridInset * p = cursor.enclosingGrid(idx); // single cell/part of cell
col_type const numcols = min(data_.ncols(), p->ncols() - p->col(idx)); cursor.insert(data_.cell(0));
row_type const numrows = min(data_.nrows(), p->nrows() - p->row(idx)); } else {
for (row_type row = 0; row < numrows; ++row) // mulitple cells
for (col_type col = 0; col < numcols; ++col) { idx_type idx;
idx_type i = p->index(row + p->row(idx), col + p->col(idx)); MathGridInset * p = cursor.enclosingGrid(idx);
p->cell(i).push_back(data_.cell(data_.index(row, col))); col_type const numcols = min(data_.ncols(), p->ncols() - p->col(idx));
} row_type const numrows = min(data_.nrows(), p->nrows() - p->row(idx));
for (row_type row = 0; row < numrows; ++row)
for (col_type col = 0; col < numcols; ++col) {
idx_type i = p->index(row + p->row(idx), col + p->col(idx));
p->cell(i).push_back(data_.cell(data_.index(row, col)));
}
}
} }
// glues selection to one cell // glues selection to one cell