summaryrefslogtreecommitdiffstats
path: root/editor/plugins/script_text_editor.cpp
diff options
context:
space:
mode:
authorDominik 'dreamsComeTrue' Jasiński <dominikjasinski@o2.pl>2020-02-09 10:10:58 +0100
committerDominik 'dreamsComeTrue' Jasiński <dominikjasinski@o2.pl>2020-02-13 23:45:05 +0100
commit4c80beab444b2734c1c1ee04b480ca1551e7db94 (patch)
treebe99b77efdde46ab19f2bd1a43ad65b3561be051 /editor/plugins/script_text_editor.cpp
parent3679d49f4b709fd56e872633ead73008bc3e1c43 (diff)
downloadredot-engine-4c80beab444b2734c1c1ee04b480ca1551e7db94.tar.gz
Added 'Replace in files' functionality to text editors
Fixes issue #31146
Diffstat (limited to 'editor/plugins/script_text_editor.cpp')
-rw-r--r--editor/plugins/script_text_editor.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 3a49538542..1ec425d09d 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1258,6 +1258,12 @@ void ScriptTextEditor::_edit_option(int p_op) {
// So this will be delegated to the ScriptEditor.
emit_signal("search_in_files_requested", selected_text);
} break;
+ case REPLACE_IN_FILES: {
+
+ String selected_text = code_editor->get_text_edit()->get_selection_text();
+
+ emit_signal("replace_in_files_requested", selected_text);
+ } break;
case SEARCH_LOCATE_FUNCTION: {
quick_open->popup_dialog(get_functions());
@@ -1882,6 +1888,7 @@ ScriptTextEditor::ScriptTextEditor() {
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace"), SEARCH_REPLACE);
search_menu->get_popup()->add_separator();
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_in_files"), SEARCH_IN_FILES);
+ search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace_in_files"), REPLACE_IN_FILES);
search_menu->get_popup()->add_separator();
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/contextual_help"), HELP_CONTEXTUAL);
search_menu->get_popup()->connect("id_pressed", this, "_edit_option");
@@ -1990,6 +1997,7 @@ void ScriptTextEditor::register_editor() {
#endif
ED_SHORTCUT("script_text_editor/find_in_files", TTR("Find in Files..."), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F);
+ ED_SHORTCUT("script_text_editor/replace_in_files", TTR("Replace in Files..."), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_R);
#ifdef OSX_ENABLED
ED_SHORTCUT("script_text_editor/contextual_help", TTR("Contextual Help"), KEY_MASK_ALT | KEY_MASK_SHIFT | KEY_SPACE);