From c3e5ddf89a4d8d8ce56c28e037c8095f1efcbf2c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 1 Feb 2002 10:21:29 +0000 Subject: [PATCH] Fix fuer #209 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3468 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_charinset.h | 2 ++ src/mathed/math_inset.h | 2 ++ src/mathed/math_parser.C | 5 ++++- src/mathed/math_symbolinset.h | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mathed/math_charinset.h b/src/mathed/math_charinset.h index e20ac397e8..fcfa806466 100644 --- a/src/mathed/math_charinset.h +++ b/src/mathed/math_charinset.h @@ -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 diff --git a/src/mathed/math_inset.h b/src/mathed/math_inset.h index e7272ded44..6c79f76b9b 100644 --- a/src/mathed/math_inset.h +++ b/src/mathed/math_inset.h @@ -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) {} diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 5c7b4b4a83..3fa0434295 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -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)); diff --git a/src/mathed/math_symbolinset.h b/src/mathed/math_symbolinset.h index e16cf8930c..018fc63b85 100644 --- a/src/mathed/math_symbolinset.h +++ b/src/mathed/math_symbolinset.h @@ -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; -- 2.39.2