]> git.lyx.org Git - features.git/commitdiff
Fix fuer #209
authorAndré Pönitz <poenitz@gmx.net>
Fri, 1 Feb 2002 10:21:29 +0000 (10:21 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 1 Feb 2002 10:21:29 +0000 (10:21 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3468 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_charinset.h
src/mathed/math_inset.h
src/mathed/math_parser.C
src/mathed/math_symbolinset.h

index e20ac397e8506e81da692d7df3c4804ac02cabf2..fcfa806466ab7455ef8ba251371386ea6c110d79 100644 (file)
@@ -56,6 +56,8 @@ public:
        void handleFont(MathTextCodes t);
        ///
        bool match(MathInset *) const;
+       /// identifies complicated things that need braces if used as arg
+       bool needsBraces() const { return false; }
 
 private:
        /// the character
index e7272ded448278fd663b3df6fbd90faf2c360d1d..6c79f76b9b21758267a89302babd8d13bf8cb822 100644 (file)
@@ -212,6 +212,8 @@ public:
        virtual MathTextCodes code() const { return LM_TC_MIN; }
        /// identifies things that can get \limits or \nolimits
        virtual bool takesLimits() const { return false; }
+       /// identifies complicated things that need braces if used as arg
+       virtual bool needsBraces() const { return true; }
 
        ///
        virtual void edit(BufferView *, int, int, unsigned int) {}
index 5c7b4b4a8391f62e0495e5f833d8ab6dfcd29499..3fa04342953069972411bd3d2b2427417b03ea30 100644 (file)
@@ -798,7 +798,10 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
 #warning this might be wrong in general!
 #endif
                        // ignore braces around simple items
-                       if (ar.size() == 1 || (ar.size() == 2 && ar.back()->asScriptInset())) {
+                       if ((ar.size() == 1 && !ar.front()->needsBraces()
+       || (ar.size() == 2 && !ar.front()->needsBraces()
+                                           && ar.back()->asScriptInset())))
+                       {
                                array.push_back(ar);
                        } else {
                                array.push_back(MathAtom(new MathBraceInset));
index e16cf8930cb9e7db632d78cade77ce5290347f9c..018fc63b8540229880905febbcca3d544cb48ef4 100644 (file)
@@ -37,6 +37,8 @@ public:
        bool match(MathInset *) const;
        /// request "external features"
        void validate(LaTeXFeatures & features) const;
+       /// identifies complicated things that need braces if used as arg
+       bool needsBraces() const { return false; }
 
        ///
        void normalize(NormalStream &) const;