Added configuable tab size

This commit is contained in:
Paulb23 2016-03-11 18:10:01 +00:00
parent 6e86a05350
commit 9234bd3ff9
4 changed files with 13 additions and 1 deletions

View File

@ -3495,6 +3495,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) { void TextEdit::set_draw_tabs(bool p_draw) {
draw_tabs=p_draw; draw_tabs=p_draw;

View File

@ -378,7 +378,7 @@ public:
void redo(); void redo();
void clear_undo_history(); void clear_undo_history();
void set_tab_size(const int p_size);
void set_draw_tabs(bool p_draw); void set_draw_tabs(bool p_draw);
bool is_drawing_tabs() const; bool is_drawing_tabs() const;

View File

@ -406,6 +406,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("text_editor/scroll_past_end_of_file", false); 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/idle_parse_delay",2);
set("text_editor/create_signal_callbacks",true); set("text_editor/create_signal_callbacks",true);
set("text_editor/autosave_interval_secs",0); set("text_editor/autosave_interval_secs",0);

View File

@ -1930,6 +1930,7 @@ void ScriptEditor::edit(const Ref<Script>& p_script) {
ste->get_text_edit()->set_tooltip_request_func(this,"_get_debug_tooltip",ste); ste->get_text_edit()->set_tooltip_request_func(this,"_get_debug_tooltip",ste);
ste->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); ste->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file"));
ste->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); ste->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete"));
ste->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size"));
ste->get_text_edit()->set_callhint_settings( ste->get_text_edit()->set_callhint_settings(
EditorSettings::get_singleton()->get("text_editor/put_callhint_tooltip_below_current_line"), EditorSettings::get_singleton()->get("text_editor/put_callhint_tooltip_below_current_line"),
EditorSettings::get_singleton()->get("text_editor/callhint_tooltip_offset")); EditorSettings::get_singleton()->get("text_editor/callhint_tooltip_offset"));
@ -2067,6 +2068,7 @@ void ScriptEditor::_editor_settings_changed() {
ste->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); ste->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete"));
ste->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); ste->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file"));
ste->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size"));
} }
} }