[LyX/master] Fix bug #11854

Enrico Forestieri forenr at lyx.org
Sun May 17 15:55:57 UTC 2020


commit 49098aa3189c8cc17ce53171eb769c2a192f6e8d
Author: Enrico Forestieri <forenr at lyx.org>
Date:   Sun May 17 18:15:00 2020 +0200

    Fix bug #11854
    
    The code was checking only for particular vertical alignment requests
    in order to decide to nest a standard array into a 1x1 ams matrix.
    However, also vertical lines are not possible in ams matrices.
---
 src/frontends/qt/GuiMathMatrix.cpp |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/frontends/qt/GuiMathMatrix.cpp b/src/frontends/qt/GuiMathMatrix.cpp
index b771931..92ba6fc 100644
--- a/src/frontends/qt/GuiMathMatrix.cpp
+++ b/src/frontends/qt/GuiMathMatrix.cpp
@@ -144,7 +144,7 @@ void GuiMathMatrix::slotOK()
 	int const ny = rowsSB->value();
 	// a matrix without a decoration is an array,
 	// otherwise it is an AMS matrix
-	// decorated matrices cannot have a vertical alignment
+	// decorated matrices cannot have a vertical alignment or line
 
 	char const c = v_align_c[valignCO->currentIndex()];
 	QString const sh = halignED->text();
@@ -154,9 +154,10 @@ void GuiMathMatrix::slotOK()
 	if (decorationCO->currentIndex() != 0) {
 		int const deco = decorationCO->currentIndex();
 		QString deco_name = DecoNames[deco - 1];
-		// only if a special alignment is set create a 1x1 AMS array in which
-		// a normal array will be created, otherwise create just a normal AMS array
-		if (sh.contains('l') || sh.contains('r')) {
+		// if a vertical line or a special alignment is requested,
+		// create a 1x1 AMS matrix containing a normal array,
+		// otherwise create just a standard AMS matrix
+		if (sh.contains('l') || sh.contains('r') || sh.contains('|')) {
 			string const str_ams = fromqstr(
 				QString("%1 %2 %3").arg(int(1)).arg(int(1)).arg(deco_name));
 			dispatch(FuncRequest(LFUN_MATH_AMS_MATRIX, str_ams));


More information about the lyx-cvs mailing list