From 5c663849d1c63f9c533510bd2c119bfca7a8f58b Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Mon, 29 Jun 2020 17:57:18 +0200 Subject: [PATCH] Update cursor idx after grid paste if columns are appended --- src/mathed/InsetMathGrid.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp index 1fd445995c..6aaddc2177 100644 --- a/src/mathed/InsetMathGrid.cpp +++ b/src/mathed/InsetMathGrid.cpp @@ -1626,6 +1626,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd) cur.recordUndoInset(); col_type startcol = col(cur.idx()); row_type startrow = cur.row(); + col_type oldncols = ncols(); col_type const numcols = min(grid.ncols(), ncols() - startcol); row_type const numrows = @@ -1652,6 +1653,8 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd) cell(i).append(grid.cell(grid.index(r, c))); } } + // amend cursor position if cols have been appended + cur.idx() += startrow * (ncols() - oldncols); // append rows for the left over vertical cells idx_type i = nargs() - 1; for (row_type r = numrows; r < grid.nrows(); ++r) { -- 2.39.5