[solver] Fix bug: when adding '=0' to an equation, force the cursor the

be at the end of the expression before adding '=0'
This commit is contained in:
Émilie Feral
2018-06-11 13:09:10 +02:00
parent 8340eb29d8
commit 4a6724115c

View File

@@ -115,6 +115,7 @@ bool textRepresentsAnEquality(const char * text) {
bool ListController::textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) {
if (textField->isEditing() && textField->textFieldShouldFinishEditing(event)) {
if (!textRepresentsAnEquality(textField->text())) {
textField->handleEvent(Ion::Events::ShiftRight);
textField->handleEventWithText("=0");
}
}
@@ -129,6 +130,7 @@ bool ListController::expressionLayoutFieldDidReceiveEvent(ExpressionLayoutField
char buffer[TextField::maxBufferSize()];
expressionLayoutField->writeTextInBuffer(buffer, TextField::maxBufferSize());
if (!textRepresentsAnEquality(buffer)) {
expressionLayoutField->handleEvent(Ion::Events::ShiftRight);
expressionLayoutField->handleEventWithText("=0");
}
}