mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 15:21:56 -05:00
Added support for space indentation
This commit is contained in:
@@ -298,10 +298,10 @@ void ScriptTextEditor::convert_indent_to_spaces() {
|
||||
return;
|
||||
}
|
||||
|
||||
int tab_size = EditorSettings::get_singleton()->get("text_editor/indent/tab_size");
|
||||
int indent_size = EditorSettings::get_singleton()->get("text_editor/indent/size");
|
||||
String indent = "";
|
||||
|
||||
for (int i = 0; i < tab_size; i++) {
|
||||
for (int i = 0; i < indent_size; i++) {
|
||||
indent += " ";
|
||||
}
|
||||
|
||||
@@ -340,8 +340,8 @@ void ScriptTextEditor::convert_indent_to_tabs() {
|
||||
return;
|
||||
}
|
||||
|
||||
int tab_size = EditorSettings::get_singleton()->get("text_editor/indent/tab_size");
|
||||
tab_size -= 1;
|
||||
int indent_size = EditorSettings::get_singleton()->get("text_editor/indent/size");
|
||||
indent_size -= 1;
|
||||
|
||||
bool changed_indentation = false;
|
||||
for (int i = 0; i < tx->get_line_count(); i++) {
|
||||
@@ -357,13 +357,13 @@ void ScriptTextEditor::convert_indent_to_tabs() {
|
||||
if (line[j] != '\t') {
|
||||
space_count++;
|
||||
|
||||
if (space_count == tab_size) {
|
||||
if (space_count == indent_size) {
|
||||
if (!changed_indentation) {
|
||||
tx->begin_complex_operation();
|
||||
changed_indentation = true;
|
||||
}
|
||||
|
||||
line = line.left(j - tab_size) + "\t" + line.right(j + 1);
|
||||
line = line.left(j - indent_size) + "\t" + line.right(j + 1);
|
||||
j = 0;
|
||||
space_count = -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user