]> git.lyx.org Git - features.git/commitdiff
Revert revision 14819 and my faulty fix for it.
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sat, 11 Nov 2006 15:26:31 +0000 (15:26 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sat, 11 Nov 2006 15:26:31 +0000 (15:26 +0000)
* 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

src/mathed/InsetMathNest.C
src/mathed/InsetMathScript.C
src/mathed/MathParser.C

index 0c7446513599f79cda03b6b672fb538a488d3618..2f2d312e3e75a2984be940da56475c7e95a34895 100644 (file)
@@ -1403,11 +1403,7 @@ bool InsetMathNest::script(LCursor & cur, bool up,
                }
                --cur.pos();
                InsetMathScript * 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);
+               // See comment in MathParser.C for special handling of {}-bases
 
                cur.push(*inset);
                cur.idx() = 1;
index d6a8eda75a7e8b2570e5322fae22fe393bb216a2..c47e23989238fda2219ab7b9cd711ee1d84f8a6f 100644 (file)
@@ -421,11 +421,7 @@ bool InsetMathScript::idxUpDown(LCursor & cur, bool up) const
 void InsetMathScript::write(WriteStream & os) const
 {
        if (nuc().size()) {
-               if (nuc().size() == 1 
-                   && ! nuc().begin()->nucleus()->asScriptInset())
-                       os << nuc();
-               else
-                       os << '{' << nuc() << '}';
+               os << nuc();
                //if (nuc().back()->takesLimits()) {
                        if (limits_ == -1)
                                os << "\\nolimits ";
index 623b9234e87fede82fce8c24a6437066e50c966a..abbe9e90c4c9174924bb5251959994a539ae0910 100644 (file)
@@ -827,14 +827,17 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
                                cell->back() = MathAtom(new InsetMathScript(cell->back(), up));
                        InsetMathScript * p = cell->back().nucleus()->asScriptInset();
                        // special handling of {}-bases
-                       // Test for empty brace inset, otherwise \xxx{\vec{H}}_{0}
-                       // where \xxx is an unknown command gets misparsed to
-                       // \xxx\vec{H}_{0}, and that is invalid LaTeX.
-                       // is this always correct?
-                       if (p->nuc().size() == 1 &&
-                           p->nuc().back()->asBraceInset() &&
-                           p->nuc().back()->asBraceInset()->cell(0).empty())
-                               p->nuc() = p->nuc().back()->asNestInset()->cell(0);
+                       // Here we could remove the brace inset for things
+                       // like {a'}^2 and add the braces back in
+                       // InsetMathScript::write().
+                       // We do not do it, since it is not possible to detect
+                       // reliably whether the braces are needed because the
+                       // nucleus contains more than one symbol, or whether
+                       // they are needed for unknown commands like \xx{a}_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);
                        if (limits) {
                                p->limits(limits);