commit 61cf165521e91f6f2b215d037d52e57bd8ce7171
Author: Juergen Spitzmueller <[email protected]>
Date:   Tue Jul 14 10:39:49 2020 +0200

    Consider single-cell insets when pasting multiple cells (#11906)
---
 src/mathed/InsetMathGrid.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp
index 9c0dca3..0a637ec 100644
--- a/src/mathed/InsetMathGrid.cpp
+++ b/src/mathed/InsetMathGrid.cpp
@@ -1649,7 +1649,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest 
& cmd)
                                // append columns for the left over horizontal 
cells
                                for (InsetMath::col_type c = numcols; c < 
grid.ncols(); ++c) {
                                        addCol(c + startcol);
-                                       idx_type i = index(r + startrow, c + 
startcol);
+                                       idx_type i = index(r + startrow, min(c 
+ startcol, ncols() - 1));
                                        cell(i).append(grid.cell(grid.index(r, 
c)));
                                        ++numcols;
                                }
@@ -1662,7 +1662,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest 
& cmd)
                                row_type crow = startrow + r;
                                addRow(crow - 1);
                                for (col_type c = 0; c < grid.ncols(); ++c)
-                                       cell(index(crow, c + 
startcol)).append(grid.cell(grid.index(r, c)));
+                                       cell(index(min(crow, nrows() - 1), 
min(c + startcol, ncols() - 1))).append(grid.cell(grid.index(r, c)));
                                if (hline_enabled)
                                        rowinfo_[crow].lines += 
grid.rowinfo_[r].lines;
                                else {
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to