[LyX/master] Fixup 7e7f9eba: we only need one hasLimits() method

Jean-Marc Lasgouttes lasgouttes at lyx.org
Tue Jun 1 14:02:20 UTC 2021


commit 7e17d1a1b7e1f3a48a8e2f9a2f30f1b3792e9f9a
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Tue Jun 1 16:12:46 2021 +0200

    Fixup 7e7f9eba: we only need one hasLimits() method
    
    Related to bug #12295.
---
 src/mathed/InsetMathScript.cpp |   14 +++-----------
 src/mathed/InsetMathScript.h   |    2 --
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/src/mathed/InsetMathScript.cpp b/src/mathed/InsetMathScript.cpp
index aa99de2..9f391f6 100644
--- a/src/mathed/InsetMathScript.cpp
+++ b/src/mathed/InsetMathScript.cpp
@@ -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) {
diff --git a/src/mathed/InsetMathScript.h b/src/mathed/InsetMathScript.h
index 38761f0..31955dd 100644
--- a/src/mathed/InsetMathScript.h
+++ b/src/mathed/InsetMathScript.h
@@ -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;


More information about the lyx-cvs mailing list