You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Add "Replace in Files" functionality to text editors
The Soft Reload Script shortcut was changed from Ctrl + Shift + R to Ctrl + Alt + R to avoid conflicts.
This commit is contained in:
committed by
Hugo Locurcio
parent
c3606a87fe
commit
7bd0eae635
@@ -1235,6 +1235,11 @@ 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());
|
||||
quick_open->set_title(TTR("Go to Function"));
|
||||
@@ -1805,6 +1810,7 @@ void ScriptTextEditor::_enable_code_editor() {
|
||||
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");
|
||||
@@ -2020,6 +2026,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);
|
||||
|
||||
Reference in New Issue
Block a user