Fix #11552 in a different way

The reported issue is fixed in a different way, not
involving the fix for #9348.

This commit supercedes [f2029fb3/lyxgit] and [17abf68b/lyxgit].
This commit is contained in:
Enrico Forestieri 2019-04-19 17:26:14 +02:00
parent 3e516a6219
commit 54147a7140

View File

@ -946,13 +946,22 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
parse(ar, FLAG_BRACE_LAST, mode); parse(ar, FLAG_BRACE_LAST, mode);
// do not create a BraceInset if they were written by LyX // do not create a BraceInset if they were written by LyX
// this helps to keep the annoyance of "a choose b" to a minimum // this helps to keep the annoyance of "a choose b" to a minimum
// But create a BraceInset if a script follows (#9348)
InsetMathBrace const * mb; InsetMathBrace const * mb;
if (ar.size() > 0) InsetMathChar const * mc;
mb = ar[0]->asBraceInset(); for (size_type i = 0; i < ar.size(); ++i) {
if (ar.size() == 1 && (ar[0]->extraBraces() mb = ar[i]->asBraceInset();
|| (mb && mb->cell(0).size() mc = mb && mb->cell(0).size() > 1 && mb->cell(0)[0]->asMacro()
&& !mb->cell(0)[0].nucleus()->asScriptInset()))) ? mb->cell(0)[1]->asCharInset(): 0;
if (mc && mc->getChar() == '[') {
// Remove the BraceInset around a macro
// with optional arguments. It will be
// automatically reinserted on write.
MathData md = mb->cell(0);
ar.erase(i);
ar.insert(i,md);
}
}
if (ar.size() == 1 && ar[0]->extraBraces())
cell->append(ar); cell->append(ar);
else else
cell->push_back(MathAtom(new InsetMathBrace(ar))); cell->push_back(MathAtom(new InsetMathBrace(ar)));