[code] Fixed cursor bug when inserting text in editor.

Now the cursor moves only if the insterion was successful.

Change-Id: If2f74307aecd4b9b86183a3437a53fd8875c1751
This commit is contained in:
Léa Saviot
2017-11-21 13:33:13 +01:00
parent 5bfc482e62
commit 07bc7672e8
2 changed files with 10 additions and 8 deletions

View File

@@ -45,7 +45,9 @@ bool EditorController::textAreaShouldFinishEditing(TextArea * textArea, Ion::Eve
bool EditorController::textAreaDidReceiveEvent(TextArea * textArea, Ion::Events::Event event) {
const char * pythonText = Helpers::PythonTextForEvent(event);
if (pythonText != nullptr) {
textArea->insertText(pythonText);
if (!textArea->insertText(pythonText)) {
return false;
}
if (pythonText[strlen(pythonText)-1] == ')') {
textArea->moveCursor(-1);
}