diff options
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 12 | ||||
-rw-r--r-- | editor/plugins/shader_editor_plugin.cpp | 3 |
3 files changed, 11 insertions, 7 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 8ce0f51211..bc6f2134a2 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1582,6 +1582,9 @@ void ScriptEditor::_save_layout() { void ScriptEditor::_editor_settings_changed() { trim_trailing_whitespace_on_save = EditorSettings::get_singleton()->get("text_editor/files/trim_trailing_whitespace_on_save"); + convert_indent_on_save = EditorSettings::get_singleton()->get("text_editor/indent/convert_indent_on_save"); + use_space_indentation = EditorSettings::get_singleton()->get("text_editor/indent/type") == "Tabs" ? 0 : 1; + float autosave_time = EditorSettings::get_singleton()->get("text_editor/files/autosave_interval_secs"); if (autosave_time > 0) { autosave_timer->set_wait_time(autosave_time); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 65be93e771..0eb53d1a66 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -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; } diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index b693913e45..b5edd12b9c 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -370,7 +370,8 @@ void ShaderEditor::_editor_settings_changed() { shader_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/completion/auto_brace_complete")); shader_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/cursor/scroll_past_end_of_file")); - shader_editor->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/indent/tab_size")); + shader_editor->get_text_edit()->set_indent_size(EditorSettings::get_singleton()->get("text_editor/indent/size")); + shader_editor->get_text_edit()->set_indent_using_spaces(EditorSettings::get_singleton()->get("text_editor/indent/type") == "Tabs" ? 0 : 1); shader_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs")); shader_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_numbers")); shader_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting")); |