From 0c19b54365535eacabebb9ab71865e6455f19220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 16 Jan 2020 17:56:24 +0100 Subject: [PATCH] [apps/calculation] Do not display additional results for Equal or Store expressions --- apps/calculation/calculation.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/calculation/calculation.cpp b/apps/calculation/calculation.cpp index 8147b0161..d3f112c7b 100644 --- a/apps/calculation/calculation.cpp +++ b/apps/calculation/calculation.cpp @@ -285,7 +285,16 @@ Calculation::EqualSign Calculation::exactAndApproximateDisplayedOutputsAreEqual( Calculation::AdditionalInformationType Calculation::additionalInformationType(Context * context) { Preferences * preferences = Preferences::sharedPreferences(); Preferences::ComplexFormat complexFormat = Expression::UpdatedComplexFormatWithTextInput(preferences->complexFormat(), m_inputText); + Expression i = input(); Expression o = exactOutput(); + /* Special case for Equal and Store: + * Equal/Store nodes have to be at the root of the expression, which prevents + * from creating new expressions with equal/store node as a child. We don't + * return any additional outputs for them to avoid bothering with special + * cases. */ + if (i.type() == ExpressionNode::Type::Equal || i.type() == ExpressionNode::Type::Store) { + return AdditionalInformationType::None; + } /* Trigonometry additional results are displayed if either input or output is a sin or a cos. Indeed, we want to capture both cases: * - > input: cos(60) * > output: 1/2