[LyX/2.5.x] Fix pasting of partial math grids (#13277)

Juergen Spitzmueller spitz at lyx.org
Mon Feb 23 07:52:29 UTC 2026


commit 0d0e6f8adfa97bf28400947d669b9771c12658cc
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sun Jan 25 13:18:58 2026 +0100

    Fix pasting of partial math grids (#13277)
    
    (cherry picked from commit 637292d737f45ac7094bc50a9f6e4509fedf079b)
---
 src/mathed/InsetMathGrid.cpp | 4 +++-
 status.25x                   | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp
index 4a712a9d3f..ce537667e0 100644
--- a/src/mathed/InsetMathGrid.cpp
+++ b/src/mathed/InsetMathGrid.cpp
@@ -1582,8 +1582,10 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
 		}
 		InsetMathGrid grid(buffer_, 1, 1);
 		if (!topaste.empty())
+			// Note that the parser errors on partial grids ending with \\.
+			// We thus strip this
 			if ((topaste.size() == 1 && isAscii(topaste))
-			    || !mathed_parse_normal(grid, topaste, parseflg)) {
+			    || !mathed_parse_normal(grid, rtrim(topaste, "\\\\"), parseflg)) {
 				resetGrid(grid);
 				mathed_parse_normal(grid, topaste, parseflg | Parse::VERBATIM);
 			}
diff --git a/status.25x b/status.25x
index 5ff971b12c..7019b25767 100644
--- a/status.25x
+++ b/status.25x
@@ -49,6 +49,8 @@ What's new
 
 * USER INTERFACE
 
+- Fix pasting of partial math grids (bug 13277).
+
 - Do not allow to split InsetArgument which does not make sense.
 
 


More information about the lyx-cvs mailing list