1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Merge pull request #72288 from MewPurPur/use-string-repeat

Use `String.repeat()` to optimize several String methods
This commit is contained in:
Clay John
2023-05-05 09:56:48 -07:00
committed by GitHub
12 changed files with 37 additions and 94 deletions

View File

@@ -1144,11 +1144,7 @@ void CodeTextEditor::insert_final_newline() {
void CodeTextEditor::convert_indent_to_spaces() {
int indent_size = EDITOR_GET("text_editor/behavior/indent/size");
String indent = "";
for (int i = 0; i < indent_size; i++) {
indent += " ";
}
String indent = String(" ").repeat(indent_size);
Vector<int> cursor_columns;
cursor_columns.resize(text_editor->get_caret_count());