diff --git a/src/mathed/math_inset.h b/src/mathed/math_inset.h index b18d419866..5a9c294e56 100644 --- a/src/mathed/math_inset.h +++ b/src/mathed/math_inset.h @@ -200,7 +200,7 @@ public: virtual MathScriptInset const * asScriptInset() const { return 0; } virtual MathSpaceInset * asSpaceInset() { return 0; } virtual MathStringInset * asStringInset() { return 0; } - virtual MathSymbolInset * asSymbolInset() { return 0; } + virtual MathSymbolInset const * asSymbolInset() const { return 0; } virtual UpdatableInset * asHyperActiveInset() const { return 0; } /// identifies things that can get scripts diff --git a/src/mathed/math_scriptinset.C b/src/mathed/math_scriptinset.C index bff30b20f1..f4559bb69f 100644 --- a/src/mathed/math_scriptinset.C +++ b/src/mathed/math_scriptinset.C @@ -3,10 +3,11 @@ #endif #include "math_scriptinset.h" -#include "debug.h" #include "math_support.h" +#include "math_symbolinset.h" #include "math_mathmlstream.h" #include "support/LAssert.h" +#include "debug.h" MathScriptInset::MathScriptInset() @@ -230,7 +231,25 @@ void MathScriptInset::draw(MathInset const * nuc, Painter & pain, bool MathScriptInset::hasLimits(MathInset const * nuc) const { - return limits_ == 1 || (limits_ == 0 && nuc && nuc->isScriptable()); + // obviuos cases + if (limits_ == 1) + return true; + if (limits_ == -1) + return false; + + // we can only display limits if the nucleus wants some + if (!nuc) + return false; + if (!nuc->isScriptable()) + return false; + + // per default \int has limits beside the \int even in displayed formulas + if (nuc->asSymbolInset()) + if (nuc->asSymbolInset()->name().find("int") != string::npos) + return false; + + // assume "real" limits for everything else + return true; } diff --git a/src/mathed/math_symbolinset.h b/src/mathed/math_symbolinset.h index b83f5b5f9b..f92a5c09b1 100644 --- a/src/mathed/math_symbolinset.h +++ b/src/mathed/math_symbolinset.h @@ -23,13 +23,13 @@ public: void draw(Painter &, int x, int y) const; /// bool isRelOp() const; - /// + /// do we take scripts? bool isScriptable() const; - /// identifies things that can get \limits or \nolimits + /// do we take \limits or \nolimits? bool takesLimits() const; - /// - MathSymbolInset * asSymbolInset() { return this; } - /// + /// identifies SymbolInset as such + MathSymbolInset const * asSymbolInset() const { return this; } + /// the LaTeX name of the symbol (without the backslash) string name() const; /// bool match(MathInset *) const;