[apps/variable_box_controller] Fix loadCurrentVariablesInScript

Scenario: write the script:

def squares():
  for i in range(660):
    forward(L)lo)

Put the cursor right of "lo" and press backspace.
This commit is contained in:
Léa Saviot
2020-05-20 11:59:18 +02:00
committed by Émilie Feral
parent 03367cfdf6
commit 691c6739af

View File

@@ -624,8 +624,13 @@ void VariableBoxController::loadCurrentVariablesInScript(const char * scriptCont
* nameLength are temporary variables that will be overriden when the
* lexer continues lexing or is destroyed.
* This was found from stepping in the code and trying. */
/* TODO: Try to understand what is happening with tokenInText and
* remove this trick.*/
while (*tokenInText == ' ') {
tokenInText++;
}
for (int i = 0; i < 3; i++) {
if (strncmp(tokenInText, name, nameLength) != 0) {
if (strncmp(tokenInText, name, nameLength) != 0 && tokenInText > scriptContent) {
tokenInText--;
} else {
break;