mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[apps/shared/text_field_delegate_app] Refuse Equal
The Equal sign now triggers a syntax error in all apps but Solver. This make its behaviour symmetrical with that of < and >. Change-Id: Ia886c547a315d5627a69f3f2acac2cbce0e202c2
This commit is contained in:
committed by
Émilie Feral
parent
fa0e8de0a9
commit
b8544e3708
@@ -68,7 +68,7 @@ bool App::isAcceptableExpression(const Poincare::Expression expression) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return !expression.isUninitialized();
|
||||
return !(expression.isUninitialized() || expression.type() == ExpressionNode::Type::Equal);
|
||||
}
|
||||
|
||||
void App::didBecomeActive(Window * window) {
|
||||
|
||||
@@ -37,13 +37,9 @@ void FunctionApp::willBecomeInactive() {
|
||||
::App::willBecomeInactive();
|
||||
}
|
||||
|
||||
bool FunctionApp::isAcceptableExpression(const Poincare::Expression expression) {
|
||||
/* We forbid functions whose type is equal because the input "2+f(3)" would be
|
||||
* simplify to an expression with an nested equal node which makes no sense. */
|
||||
if (!TextFieldDelegateApp::ExpressionCanBeSerialized(expression, false, Expression(), localContext()) || expression.type() == ExpressionNode::Type::Equal) {
|
||||
return false;
|
||||
}
|
||||
return TextFieldDelegateApp::isAcceptableExpression(expression);
|
||||
|
||||
bool FunctionApp::isAcceptableExpression(const Expression exp) {
|
||||
return TextFieldDelegateApp::isAcceptableExpression(exp) && ExpressionCanBeSerialized(exp, false, Expression(), localContext());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -85,13 +85,7 @@ bool TextFieldDelegateApp::isFinishingEvent(Ion::Events::Event event) {
|
||||
}
|
||||
|
||||
bool TextFieldDelegateApp::isAcceptableExpression(const Expression exp) {
|
||||
if (exp.isUninitialized()) {
|
||||
return false;
|
||||
}
|
||||
if (exp.type() == ExpressionNode::Type::Store) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return !(exp.isUninitialized() || exp.type() == ExpressionNode::Type::Store || exp.type() == ExpressionNode::Type::Equal);
|
||||
}
|
||||
|
||||
bool TextFieldDelegateApp::ExpressionCanBeSerialized(const Expression expression, bool replaceAns, Expression ansExpression, Context * context) {
|
||||
|
||||
@@ -64,4 +64,10 @@ void App::willBecomeInactive() {
|
||||
::App::willBecomeInactive();
|
||||
}
|
||||
|
||||
|
||||
bool App::isAcceptableExpression(const Poincare::Expression exp) {
|
||||
return TextFieldDelegateApp::ExpressionCanBeSerialized(exp, false, Poincare::Expression(), localContext())
|
||||
&& !(exp.isUninitialized() || exp.type() == Poincare::ExpressionNode::Type::Store);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,6 +46,9 @@ public:
|
||||
void willBecomeInactive() override;
|
||||
TELEMETRY_ID("Solver");
|
||||
private:
|
||||
// TextFieldDelegateApp
|
||||
bool isAcceptableExpression(const Poincare::Expression expression) override;
|
||||
|
||||
App(Snapshot * snapshot);
|
||||
SolutionsController m_solutionsController;
|
||||
IntervalController m_intervalController;
|
||||
|
||||
Reference in New Issue
Block a user