mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 12:32:26 +00:00
Revert revision 14819 and my faulty fix for it.
* src/mathed/InsetMathScript.C (InsetMathScript::write): Do not add braces to the nucleus * src/mathed/MathParser.C (Parser::parse1): Do not remove brace insets from the nucleus of script insets * src/mathed/InsetMathNest.C (InsetMathNest::script): ditto git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15859 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
04157d9cb8
commit
8c651169ef
@ -1403,11 +1403,7 @@ bool InsetMathNest::script(LCursor & cur, bool up,
|
|||||||
}
|
}
|
||||||
--cur.pos();
|
--cur.pos();
|
||||||
InsetMathScript * inset = cur.nextAtom().nucleus()->asScriptInset();
|
InsetMathScript * inset = cur.nextAtom().nucleus()->asScriptInset();
|
||||||
// special handling of {}-bases
|
// See comment in MathParser.C for 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.push(*inset);
|
||||||
cur.idx() = 1;
|
cur.idx() = 1;
|
||||||
|
@ -421,11 +421,7 @@ bool InsetMathScript::idxUpDown(LCursor & cur, bool up) const
|
|||||||
void InsetMathScript::write(WriteStream & os) const
|
void InsetMathScript::write(WriteStream & os) const
|
||||||
{
|
{
|
||||||
if (nuc().size()) {
|
if (nuc().size()) {
|
||||||
if (nuc().size() == 1
|
|
||||||
&& ! nuc().begin()->nucleus()->asScriptInset())
|
|
||||||
os << nuc();
|
os << nuc();
|
||||||
else
|
|
||||||
os << '{' << nuc() << '}';
|
|
||||||
//if (nuc().back()->takesLimits()) {
|
//if (nuc().back()->takesLimits()) {
|
||||||
if (limits_ == -1)
|
if (limits_ == -1)
|
||||||
os << "\\nolimits ";
|
os << "\\nolimits ";
|
||||||
|
@ -827,14 +827,17 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
cell->back() = MathAtom(new InsetMathScript(cell->back(), up));
|
cell->back() = MathAtom(new InsetMathScript(cell->back(), up));
|
||||||
InsetMathScript * p = cell->back().nucleus()->asScriptInset();
|
InsetMathScript * p = cell->back().nucleus()->asScriptInset();
|
||||||
// special handling of {}-bases
|
// special handling of {}-bases
|
||||||
// Test for empty brace inset, otherwise \xxx{\vec{H}}_{0}
|
// Here we could remove the brace inset for things
|
||||||
// where \xxx is an unknown command gets misparsed to
|
// like {a'}^2 and add the braces back in
|
||||||
// \xxx\vec{H}_{0}, and that is invalid LaTeX.
|
// InsetMathScript::write().
|
||||||
// is this always correct?
|
// We do not do it, since it is not possible to detect
|
||||||
if (p->nuc().size() == 1 &&
|
// reliably whether the braces are needed because the
|
||||||
p->nuc().back()->asBraceInset() &&
|
// nucleus contains more than one symbol, or whether
|
||||||
p->nuc().back()->asBraceInset()->cell(0).empty())
|
// they are needed for unknown commands like \xx{a}_0
|
||||||
p->nuc() = p->nuc().back()->asNestInset()->cell(0);
|
// or \yy{a}{b}_0. This was done in revision 14819
|
||||||
|
// in an unreliable way. See this thread
|
||||||
|
// http://www.mail-archive.com/lyx-devel%40lists.lyx.org/msg104917.html
|
||||||
|
// for more details.
|
||||||
parse(p->cell(p->idxOfScript(up)), FLAG_ITEM, mode);
|
parse(p->cell(p->idxOfScript(up)), FLAG_ITEM, mode);
|
||||||
if (limits) {
|
if (limits) {
|
||||||
p->limits(limits);
|
p->limits(limits);
|
||||||
|
Loading…
Reference in New Issue
Block a user