mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Handle properly script insets which nucleus has more than one
element (like {a'}^{2}). (froward port from 14802) * src/mathed/math_nestinset.C (script): when creating a script inset, handle specially previous atom if it is a MathBraceInset (this is used in interactive input). * src/mathed/math_parser.C (parse1): when creating a script inset, handle specially previous atom if it is a MathBraceInset (this is used in parsing phase). * src/mathed/math_scriptinset.C (write): put nucleus into braces if it contains more than one element or is itself a script inset. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14819 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b124158c34
commit
b4d20b81af
@ -1368,6 +1368,12 @@ bool MathNestInset::script(LCursor & cur, bool up, string const &
|
||||
}
|
||||
--cur.pos();
|
||||
MathScriptInset * inset = cur.nextAtom().nucleus()->asScriptInset();
|
||||
// special handling of {}-bases
|
||||
// is this always correct?
|
||||
if (inset->nuc().size() == 1
|
||||
&& inset->nuc().back()->asBraceInset())
|
||||
inset->nuc() = inset->nuc().back()->asNestInset()->cell(0);
|
||||
|
||||
cur.push(*inset);
|
||||
cur.idx() = 1;
|
||||
cur.pos() = 0;
|
||||
|
@ -813,10 +813,9 @@ void Parser::parse1(MathGridInset & grid, unsigned flags,
|
||||
MathScriptInset * p = cell->back().nucleus()->asScriptInset();
|
||||
// special handling of {}-bases
|
||||
// is this always correct?
|
||||
// It appears that this is wrong (Dekel)
|
||||
//if (p->nuc().size() == 1 && p->nuc().back()->asNestInset() &&
|
||||
// p->nuc().back()->extraBraces())
|
||||
// p->nuc() = p->nuc().back()->asNestInset()->cell(0);
|
||||
if (p->nuc().size() == 1
|
||||
&& p->nuc().back()->asBraceInset())
|
||||
p->nuc() = p->nuc().back()->asNestInset()->cell(0);
|
||||
parse(p->cell(p->idxOfScript(up)), FLAG_ITEM, mode);
|
||||
if (limits) {
|
||||
p->limits(limits);
|
||||
|
@ -420,7 +420,11 @@ bool MathScriptInset::idxUpDown(LCursor & cur, bool up) const
|
||||
void MathScriptInset::write(WriteStream & os) const
|
||||
{
|
||||
if (nuc().size()) {
|
||||
os << nuc();
|
||||
if (nuc().size() == 1
|
||||
&& ! nuc().begin()->nucleus()->asScriptInset())
|
||||
os << nuc();
|
||||
else
|
||||
os << '{' << nuc() << '}';
|
||||
//if (nuc().back()->takesLimits()) {
|
||||
if (limits_ == -1)
|
||||
os << "\\nolimits ";
|
||||
|
Loading…
Reference in New Issue
Block a user