[apps] Code: allocate the indentation buffer instead of using an

arbitrary value
This commit is contained in:
Émilie Feral
2018-04-10 10:52:45 +02:00
committed by Ecco
parent a9e8cc3f35
commit 92d2c42ff8

View File

@@ -88,13 +88,14 @@ bool EditorController::textAreaDidReceiveEvent(TextArea * textArea, Ion::Events:
indentationIndex++;
}
}
char indentationBuffer[50]; // FIXME
char * indentationBuffer = new char [indentationSize+2];
indentationBuffer[0] = '\n';
for (int i = 0; i < indentationSize; i++) {
indentationBuffer[i+1] = ' ';
}
indentationBuffer[indentationSize+1] = 0;
textArea->handleEventWithText(indentationBuffer);
delete[] indentationBuffer;
return true;
}