diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 660239ccc28..d50d7bde419 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3486,6 +3486,13 @@ void TextEdit::_push_current_op() { } +void TextEdit::set_tab_size(const int p_size) { + ERR_FAIL_COND(p_size <= 0); + tab_size = p_size; + text.set_tab_size(p_size); + update(); +} + void TextEdit::set_draw_tabs(bool p_draw) { draw_tabs=p_draw; diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 207d6eb1319..d38c57804d5 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -379,7 +379,7 @@ public: void redo(); void clear_undo_history(); - + void set_tab_size(const int p_size); void set_draw_tabs(bool p_draw); bool is_drawing_tabs() const; diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index e70a50788f6..6c18e2e3642 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -484,6 +484,9 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { set("text_editor/scroll_past_end_of_file", false); + set("text_editor/tab_size", 4); + hints["text_editor/tab_size"]=PropertyInfo(Variant::INT,"text_editor/tab_size",PROPERTY_HINT_RANGE,"1, 64, 1"); // size of 0 crashes. + set("text_editor/idle_parse_delay",2); set("text_editor/create_signal_callbacks",true); set("text_editor/autosave_interval_secs",0); diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 2fb5dd619eb..72cf31772c2 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1929,6 +1929,7 @@ void ScriptEditor::edit(const Ref