[apps] Calculation: input text stores in cache have to be checked again

when used as its length context dependent (because of 'ans' symbol)
This commit is contained in:
Émilie Feral
2018-01-31 15:37:02 +01:00
committed by EmilieNumworks
parent 53393524ef
commit a8fe8dc22e
3 changed files with 27 additions and 15 deletions

View File

@@ -87,6 +87,11 @@ void EditExpressionController::didBecomeFirstResponder() {
bool EditExpressionController::textFieldDidReceiveEvent(::TextField * textField, Ion::Events::Event event) {
if (textField->isEditing() && textField->textFieldShouldFinishEditing(event) && textField->draftTextLength() == 0 && m_cacheBuffer[0] != 0) {
App * calculationApp = (App *)app();
/* The input text store in m_cacheBuffer might have beed correct the first
* time but then be too long when replacing ans in another context */
if (!calculationApp->textInputIsCorrect(m_cacheBuffer)) {
return true;
}
m_calculationStore->push(m_cacheBuffer, calculationApp->localContext());
m_historyController->reload();
((ContentView *)view())->mainView()->scrollToCell(0, m_historyController->numberOfRows()-1);