[apps] Never return n after event XNT except in sequence

Change-Id: Ibdd3de34fbba73112f4f1bc15cbac81a19e81a58
This commit is contained in:
Émilie Feral
2017-05-03 17:03:48 +02:00
parent 73213435f0
commit 19b1caebc4

View File

@@ -26,23 +26,8 @@ const char * TextFieldDelegateApp::XNT() {
}
bool TextFieldDelegateApp::cursorInToken(TextField * textField, const char * token) {
const char * text = textField->text();
int location = textField->cursorLocation();
int tokenLength = strlen(token);
while (location >= 0) {
while (text[location] != '(') {
location --;
}
if (location - tokenLength < 0) {
return false;
}
char previousToken[10];
strlcpy(previousToken, text+location-tokenLength, tokenLength+1);
if (strcmp(previousToken, token) == 0) {
return true;
}
location--;
}
/* TODO: find a way to return true when cursor is in token(?,,). Warning: be
* able to differenciate sum(int(x,1,2),3,4) and sum(2*n,2,3) */
return false;
}