diff options
Diffstat (limited to 'tools/editor/code_editor.cpp')
-rw-r--r-- | tools/editor/code_editor.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index ea87ac625b..a780c0173e 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -510,18 +510,26 @@ void CodeTextEditor::set_error(const String& p_error) { } -void CodeTextEditor::_update_font() { - - String editor_font = EditorSettings::get_singleton()->get("text_editor/font"); +void CodeTextEditor::_on_settings_change() { + + // FONTS + String editor_font = EDITOR_DEF("text_editor/font", ""); + bool font_overrode = false; if (editor_font!="") { Ref<Font> fnt = ResourceLoader::load(editor_font); if (fnt.is_valid()) { text_editor->add_font_override("font",fnt); - return; + font_overrode = true; } } - - text_editor->add_font_override("font",get_font("source","Fonts")); + if(!font_overrode) + text_editor->add_font_override("font",get_font("source","Fonts")); + + // AUTO BRACE COMPLETION + text_editor->set_auto_brace_completion( + EDITOR_DEF("text_editor/auto_brace_complete", false) + ); + } void CodeTextEditor::_text_changed_idle_timeout() { @@ -541,7 +549,7 @@ void CodeTextEditor::_bind_methods() { ObjectTypeDB::bind_method("_line_col_changed",&CodeTextEditor::_line_col_changed); ObjectTypeDB::bind_method("_text_changed",&CodeTextEditor::_text_changed); - ObjectTypeDB::bind_method("_update_font",&CodeTextEditor::_update_font); + ObjectTypeDB::bind_method("_on_settings_change",&CodeTextEditor::_on_settings_change); ObjectTypeDB::bind_method("_text_changed_idle_timeout",&CodeTextEditor::_text_changed_idle_timeout); ObjectTypeDB::bind_method("_complete_request",&CodeTextEditor::_complete_request); } @@ -586,5 +594,5 @@ CodeTextEditor::CodeTextEditor() { text_editor->set_completion(true,cs); idle->connect("timeout", this,"_text_changed_idle_timeout"); - EditorSettings::get_singleton()->connect("settings_changed",this,"_update_font"); + EditorSettings::get_singleton()->connect("settings_changed",this,"_on_settings_change"); } |