diff options
author | Paulb23 <p_batty@hotmail.co.uk> | 2021-07-09 11:52:49 +0100 |
---|---|---|
committer | Paulb23 <p_batty@hotmail.co.uk> | 2021-08-12 09:29:16 +0100 |
commit | 7e70f9e0b9696fab55e2d0570c6bdc8b07c14462 (patch) | |
tree | 7a5dba0fad93df8d9e3d8c44d7111949d756299b /editor | |
parent | d5dcaee4c5b41faca64f02888b152f7f05c4a20b (diff) |
Expose and cleanup TextEdit line wrap API
Diffstat (limited to 'editor')
-rw-r--r-- | editor/code_editor.cpp | 2 | ||||
-rw-r--r-- | editor/editor_properties.cpp | 4 | ||||
-rw-r--r-- | editor/editor_settings.cpp | 4 | ||||
-rw-r--r-- | editor/plugin_config_dialog.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/version_control_editor_plugin.cpp | 2 |
5 files changed, 8 insertions, 6 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 0aab0463c4..57c69f5aab 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -950,7 +950,7 @@ void CodeTextEditor::update_editor_settings() { text_editor->set_draw_bookmarks_gutter(EditorSettings::get_singleton()->get("text_editor/appearance/show_bookmark_gutter")); text_editor->set_line_folding_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/code_folding")); text_editor->set_draw_fold_gutter(EditorSettings::get_singleton()->get("text_editor/appearance/code_folding")); - text_editor->set_wrap_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/word_wrap")); + text_editor->set_line_wrapping_mode((TextEdit::LineWrappingMode)EditorSettings::get_singleton()->get("text_editor/appearance/word_wrap").operator int()); text_editor->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/cursor/scroll_past_end_of_file")); text_editor->set_caret_type((TextEdit::CaretType)EditorSettings::get_singleton()->get("text_editor/cursor/type").operator int()); text_editor->set_caret_blink_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink")); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 789cabea9a..ecc11998ac 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -121,7 +121,7 @@ void EditorPropertyMultilineText::_open_big_text() { if (!big_text_dialog) { big_text = memnew(TextEdit); big_text->connect("text_changed", callable_mp(this, &EditorPropertyMultilineText::_big_text_changed)); - big_text->set_wrap_enabled(true); + big_text->set_line_wrapping_mode(TextEdit::LineWrappingMode::LINE_WRAPPING_BOUNDARY); big_text_dialog = memnew(AcceptDialog); big_text_dialog->add_child(big_text); big_text_dialog->set_title(TTR("Edit Text:")); @@ -166,7 +166,7 @@ EditorPropertyMultilineText::EditorPropertyMultilineText() { set_bottom_editor(hb); text = memnew(TextEdit); text->connect("text_changed", callable_mp(this, &EditorPropertyMultilineText::_text_changed)); - text->set_wrap_enabled(true); + text->set_line_wrapping_mode(TextEdit::LineWrappingMode::LINE_WRAPPING_BOUNDARY); add_focusable(text); hb->add_child(text); text->set_h_size_flags(SIZE_EXPAND_FILL); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 65d75968f6..009a83994c 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -525,7 +525,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("text_editor/appearance/show_bookmark_gutter", true); _initial_set("text_editor/appearance/show_info_gutter", true); _initial_set("text_editor/appearance/code_folding", true); - _initial_set("text_editor/appearance/word_wrap", false); + _initial_set("text_editor/appearance/word_wrap", 0); + hints["text_editor/appearance/word_wrap"] = PropertyInfo(Variant::INT, "text_editor/appearance/word_wrap", PROPERTY_HINT_ENUM, "None,Boundary"); + _initial_set("text_editor/appearance/show_line_length_guidelines", true); _initial_set("text_editor/appearance/line_length_guideline_soft_column", 80); hints["text_editor/appearance/line_length_guideline_soft_column"] = PropertyInfo(Variant::INT, "text_editor/appearance/line_length_guideline_soft_column", PROPERTY_HINT_RANGE, "20, 160, 1"); diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp index 5fe466140b..a3ff312497 100644 --- a/editor/plugin_config_dialog.cpp +++ b/editor/plugin_config_dialog.cpp @@ -282,7 +282,7 @@ PluginConfigDialog::PluginConfigDialog() { desc_edit = memnew(TextEdit); desc_edit->set_custom_minimum_size(Size2(400, 80) * EDSCALE); - desc_edit->set_wrap_enabled(true); + desc_edit->set_line_wrapping_mode(TextEdit::LineWrappingMode::LINE_WRAPPING_BOUNDARY); grid->add_child(desc_edit); // Author diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index a9a36427db..aaa29bcb7a 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -484,7 +484,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { commit_message->set_h_grow_direction(Control::GrowDirection::GROW_DIRECTION_BEGIN); commit_message->set_v_grow_direction(Control::GrowDirection::GROW_DIRECTION_END); commit_message->set_custom_minimum_size(Size2(200, 100)); - commit_message->set_wrap_enabled(true); + commit_message->set_line_wrapping_mode(TextEdit::LineWrappingMode::LINE_WRAPPING_BOUNDARY); commit_message->connect("text_changed", callable_mp(this, &VersionControlEditorPlugin::_update_commit_button)); commit_message->connect("gui_input", callable_mp(this, &VersionControlEditorPlugin::_commit_message_gui_input)); commit_box_vbc->add_child(commit_message); |