git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3468 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-02-01 10:21:29 +00:00
parent 7c49abda63
commit c3e5ddf89a
4 changed files with 10 additions and 1 deletions

View 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

View 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) {}

View 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));

View 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;