summaryrefslogtreecommitdiffstats
path: root/editor/plugins/text_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins/text_editor.cpp')
-rw-r--r--editor/plugins/text_editor.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index 92ee468bc2..475aba0eeb 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -352,27 +352,27 @@ void TextEditor::_edit_option(int p_op) {
switch (p_op) {
case EDIT_UNDO: {
tx->undo();
- tx->call_deferred(SNAME("grab_focus"));
+ callable_mp((Control *)tx, &Control::grab_focus).call_deferred();
} break;
case EDIT_REDO: {
tx->redo();
- tx->call_deferred(SNAME("grab_focus"));
+ callable_mp((Control *)tx, &Control::grab_focus).call_deferred();
} break;
case EDIT_CUT: {
tx->cut();
- tx->call_deferred(SNAME("grab_focus"));
+ callable_mp((Control *)tx, &Control::grab_focus).call_deferred();
} break;
case EDIT_COPY: {
tx->copy();
- tx->call_deferred(SNAME("grab_focus"));
+ callable_mp((Control *)tx, &Control::grab_focus).call_deferred();
} break;
case EDIT_PASTE: {
tx->paste();
- tx->call_deferred(SNAME("grab_focus"));
+ callable_mp((Control *)tx, &Control::grab_focus).call_deferred();
} break;
case EDIT_SELECT_ALL: {
tx->select_all();
- tx->call_deferred(SNAME("grab_focus"));
+ callable_mp((Control *)tx, &Control::grab_focus).call_deferred();
} break;
case EDIT_MOVE_LINE_UP: {
code_editor->move_lines_up();
@@ -392,6 +392,9 @@ void TextEditor::_edit_option(int p_op) {
case EDIT_DUPLICATE_SELECTION: {
code_editor->duplicate_selection();
} break;
+ case EDIT_DUPLICATE_LINES: {
+ code_editor->get_text_editor()->duplicate_lines();
+ } break;
case EDIT_TOGGLE_FOLD_LINE: {
int previous_line = -1;
for (int caret_idx : tx->get_caret_index_edit_order()) {
@@ -651,6 +654,7 @@ TextEditor::TextEditor() {
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/unfold_all_lines"), EDIT_UNFOLD_ALL_LINES);
edit_menu->get_popup()->add_separator();
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/duplicate_selection"), EDIT_DUPLICATE_SELECTION);
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/duplicate_lines"), EDIT_DUPLICATE_LINES);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_word_wrap"), EDIT_TOGGLE_WORD_WRAP);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/trim_trailing_whitespace"), EDIT_TRIM_TRAILING_WHITESAPCE);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_spaces"), EDIT_CONVERT_INDENT_TO_SPACES);
@@ -658,18 +662,18 @@ TextEditor::TextEditor() {
edit_menu->get_popup()->add_separator();
PopupMenu *convert_case = memnew(PopupMenu);
- convert_case->set_name("convert_case");
+ convert_case->set_name("ConvertCase");
edit_menu->get_popup()->add_child(convert_case);
- edit_menu->get_popup()->add_submenu_item(TTR("Convert Case"), "convert_case");
+ edit_menu->get_popup()->add_submenu_item(TTR("Convert Case"), "ConvertCase");
convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_uppercase", TTR("Uppercase")), EDIT_TO_UPPERCASE);
convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_lowercase", TTR("Lowercase")), EDIT_TO_LOWERCASE);
convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize")), EDIT_CAPITALIZE);
convert_case->connect("id_pressed", callable_mp(this, &TextEditor::_edit_option));
highlighter_menu = memnew(PopupMenu);
- highlighter_menu->set_name("highlighter_menu");
+ highlighter_menu->set_name("HighlighterMenu");
edit_menu->get_popup()->add_child(highlighter_menu);
- edit_menu->get_popup()->add_submenu_item(TTR("Syntax Highlighter"), "highlighter_menu");
+ edit_menu->get_popup()->add_submenu_item(TTR("Syntax Highlighter"), "HighlighterMenu");
highlighter_menu->connect("id_pressed", callable_mp(this, &TextEditor::_change_syntax_highlighter));
Ref<EditorPlainTextSyntaxHighlighter> plain_highlighter;
@@ -692,9 +696,9 @@ TextEditor::TextEditor() {
goto_menu->get_popup()->add_separator();
bookmarks_menu = memnew(PopupMenu);
- bookmarks_menu->set_name("Bookmarks");
+ bookmarks_menu->set_name("BookmarksMenu");
goto_menu->get_popup()->add_child(bookmarks_menu);
- goto_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "Bookmarks");
+ goto_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "BookmarksMenu");
_update_bookmark_list();
bookmarks_menu->connect("about_to_popup", callable_mp(this, &TextEditor::_update_bookmark_list));
bookmarks_menu->connect("index_pressed", callable_mp(this, &TextEditor::_bookmark_item_pressed));