mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
Fix LFUN_MATH_AMS_MATRIX: it was possible to generate corrupt documents (part of #8359)
This commit is contained in:
parent
07baa69875
commit
adc78fac32
@ -1673,10 +1673,12 @@ void LyXAction::init()
|
||||
{ LFUN_MATH_MATRIX, "math-matrix", Noop, Math },
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_MATH_AMS_MATRIX
|
||||
* \li Action: Inserts a matrix.
|
||||
* \li Action: Inserts an extended matrix as provided by the amsmath package.
|
||||
* \li Syntax: math-matrix <COLS> <ROWS> [<DECORATION>]
|
||||
* \li Params: <DECORATION>: Decoration determines the LaTeX name of the matrix
|
||||
that should be created.
|
||||
that should be created. Possible values include
|
||||
pmatrix, bmatrix, Bmatrix, vmatrix, Vmatrix and
|
||||
matrix. The default is 'matrix'.
|
||||
* \li Sample: math-ams-matrix 3 3 bmatrix
|
||||
* \endvar
|
||||
*/
|
||||
|
@ -1076,13 +1076,19 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
cur.recordUndo();
|
||||
unsigned int m = 1;
|
||||
unsigned int n = 1;
|
||||
docstring name;
|
||||
docstring name = from_ascii("matrix");
|
||||
idocstringstream is(cmd.argument());
|
||||
is >> m >> n >> name;
|
||||
if (m < 1)
|
||||
m = 1;
|
||||
if (n < 1)
|
||||
n = 1;
|
||||
// check if we have a valid decoration
|
||||
if (name != "pmatrix" && name != "bmatrix"
|
||||
&& name != "Bmatrix" && name != "vmatrix"
|
||||
&& name != "Vmatrix" && name != "matrix")
|
||||
name = from_ascii("matrix");
|
||||
|
||||
cur.niceInsert(
|
||||
MathAtom(new InsetMathAMSArray(buffer_, name, m, n)));
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user