Fixup 7e7f9eba: we only need one hasLimits() method

Related to bug #12295.
This commit is contained in:
Jean-Marc Lasgouttes 2021-06-01 16:12:46 +02:00
parent 7e7f9ebae8
commit 7e17d1a1b7
2 changed files with 3 additions and 13 deletions

View File

@ -289,7 +289,7 @@ MathClass InsetMathScript::mathClass() const
void InsetMathScript::metrics(MetricsInfo & mi, Dimension & dim) const
{
// we store this, because it is much easier
has_limits_ = hasLimits(mi.base.font);
has_limits_ = hasLimits(mi.base.font.style());
// Compute metrics of the available cells
Dimension dim0;
@ -385,27 +385,19 @@ void InsetMathScript::drawT(TextPainter & pain, int x, int y) const
}
bool InsetMathScript::hasLimits(FontInfo const & font) const
bool InsetMathScript::hasLimits(MathStyle const & style) const
{
if (nuc().empty())
return false;
Limits const lim = nuc().back()->limits() == AUTO_LIMITS
? nuc().back()->defaultLimits(font.style() == DISPLAY_STYLE)
? nuc().back()->defaultLimits(style == DISPLAY_STYLE)
: nuc().back()->limits();
LASSERT(lim != AUTO_LIMITS, return false);
return lim == LIMITS;
}
bool InsetMathScript::hasLimits(MathStyle const & style) const
{
FontInfo font = sane_font;
font.setStyle(style);
return hasLimits(font);
}
void InsetMathScript::removeScript(bool up)
{
if (nargs() == 2) {

View File

@ -135,8 +135,6 @@ private:
/// subscript to the left.
int nker(BufferView const * bv) const;
/// do we we have to draw the scripts above/below nucleus?
bool hasLimits(FontInfo const &) const;
///
bool hasLimits(MathStyle const &) const;
/// clean up empty cells and return true if a cell has been deleted.
bool notifyCursorLeaves(Cursor const & old, Cursor & cur) override;