[escher] Fixed TextField bug.

The Statistics apps crashed when navigating the Data table.
 -> Check that the textfield is editing before calling
textFieldShouldFinishEditing.
 -> Changed textLength() to draftTextLength().

Change-Id: Id373a7cd50438303f470abc5bcee7a795c33926a
This commit is contained in:
Léa Saviot
2017-11-27 15:22:48 +01:00
parent 4659d27c80
commit e43bbd38f2
8 changed files with 37 additions and 38 deletions

View File

@@ -274,7 +274,7 @@ bool MenuController::textFieldShouldFinishEditing(TextField * textField, Ion::Ev
bool MenuController::textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) {
if (event == Ion::Events::Right && textField->isEditing()) {
int scriptExtensionLength = strlen(ScriptStore::k_scriptExtension);
if (textField->cursorLocation() > textField->textLength() - scriptExtensionLength - 1) {
if (textField->cursorLocation() > textField->draftTextLength() - scriptExtensionLength - 1) {
return true;
}
}