commit 5c663849d1c63f9c533510bd2c119bfca7a8f58b
Author: Juergen Spitzmueller <[email protected]>
Date:   Mon Jun 29 17:57:18 2020 +0200

    Update cursor idx after grid paste if columns are appended
---
 src/mathed/InsetMathGrid.cpp |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp
index 1fd4459..6aaddc2 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) {
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to