From c2db00cc883de0a9c0ee84f1e9cf57f7ece3867f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 16 Jul 2020 11:14:52 +0200 Subject: [PATCH] [apps/calculation] When leaving calculation app, do not invalid calculation height memoization. They're computed from the layouts which don't depend on the complex format (or any other settings parameters which could have changed). --- apps/calculation/calculation.cpp | 7 +------ apps/calculation/calculation.h | 2 -- apps/calculation/calculation_store.cpp | 3 --- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/apps/calculation/calculation.cpp b/apps/calculation/calculation.cpp index f44a40c62..cfa79bb4f 100644 --- a/apps/calculation/calculation.cpp +++ b/apps/calculation/calculation.cpp @@ -38,12 +38,6 @@ Calculation * Calculation::next() const { return reinterpret_cast(const_cast(result)); } -void Calculation::tidy() { - /* Reset height memoization (the complex format could have changed when - * re-entering Calculation app which would impact the heights). */ - resetHeightMemoization(); -} - const char * Calculation::approximateOutputText(NumberOfSignificantDigits numberOfSignificantDigits) const { const char * exactOutput = exactOutputText(); const char * approximateOutputTextWithMaxNumberOfDigits = exactOutput + strlen(exactOutput) + 1; @@ -219,6 +213,7 @@ Calculation::EqualSign Calculation::exactAndApproximateDisplayedOutputsAreEqual( Poincare::ExceptionCheckpoint ecp; if (ExceptionRun(ecp)) { Preferences * preferences = Preferences::sharedPreferences(); + // TODO: complex format should not be needed here (as it is not used to create layouts) Preferences::ComplexFormat complexFormat = Expression::UpdatedComplexFormatWithTextInput(preferences->complexFormat(), m_inputText); m_equalSign = Expression::ParsedExpressionsAreEqual(exactOutputText(), approximateOutputText(NumberOfSignificantDigits::UserDefined), context, complexFormat, preferences->angleUnit()) ? EqualSign::Equal : EqualSign::Approximation; return m_equalSign; diff --git a/apps/calculation/calculation.h b/apps/calculation/calculation.h index a09253abc..01c7f5d5e 100644 --- a/apps/calculation/calculation.h +++ b/apps/calculation/calculation.h @@ -61,8 +61,6 @@ public: bool operator==(const Calculation& c); Calculation * next() const; - void tidy(); - // Texts enum class NumberOfSignificantDigits { Maximal, diff --git a/apps/calculation/calculation_store.cpp b/apps/calculation/calculation_store.cpp index fbac03577..47f5ebebf 100644 --- a/apps/calculation/calculation_store.cpp +++ b/apps/calculation/calculation_store.cpp @@ -163,9 +163,6 @@ void CalculationStore::tidy() { return; } resetMemoizedModelsAfterCalculationIndex(-1); - for (Calculation * c : *this) { - c->tidy(); - } } Expression CalculationStore::ansExpression(Context * context) {