[code] EditorController: avoid dynamic allocation

This commit is contained in:
Émilie Feral
2018-09-11 16:22:14 +02:00
parent 79740e72b0
commit 032db99754

View File

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