summaryrefslogtreecommitdiffstats
path: root/editor/plugins/text_editor.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-09-26 08:16:33 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-09-26 08:16:33 +0200
commit1aa2d8ba1981f3d266b16681a2e614127b5c6c83 (patch)
tree9713b2ebebd061732618e1e3a817388976ca7d47 /editor/plugins/text_editor.cpp
parent43b9e89a07bb0926fb66bddbf98981d25a5cccee (diff)
parentd2e651f403b7f583a66e37ef0331362ad70fd1c3 (diff)
downloadredot-engine-1aa2d8ba1981f3d266b16681a2e614127b5c6c83.tar.gz
Merge pull request #66553 from PucklaJ/duplicate_lines
Add Duplicate Lines shortcut to CodeTextEditor
Diffstat (limited to 'editor/plugins/text_editor.cpp')
-rw-r--r--editor/plugins/text_editor.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index 92ee468bc2..b0a69cfb5c 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -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);