summaryrefslogtreecommitdiffstats
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/code_editor.cpp5
-rw-r--r--editor/plugins/script_text_editor.cpp6
-rw-r--r--editor/plugins/script_text_editor.h1
-rw-r--r--editor/plugins/text_editor.cpp4
-rw-r--r--editor/plugins/text_editor.h1
-rw-r--r--editor/plugins/text_shader_editor.cpp4
-rw-r--r--editor/plugins/text_shader_editor.h1
7 files changed, 22 insertions, 0 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 876fef078b..9d2b54ef1a 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -805,6 +805,11 @@ void CodeTextEditor::input(const Ref<InputEvent> &event) {
accept_event();
return;
}
+ if (ED_IS_SHORTCUT("script_text_editor/duplicate_lines", key_event)) {
+ text_editor->duplicate_lines();
+ accept_event();
+ return;
+ }
}
void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index d5ad21e346..dc3f88705b 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1306,6 +1306,9 @@ void ScriptTextEditor::_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()) {
@@ -2173,6 +2176,7 @@ void ScriptTextEditor::_enable_code_editor() {
edit_menu->get_popup()->add_separator();
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("ui_text_select_all"), EDIT_SELECT_ALL);
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/evaluate_selection"), EDIT_EVALUATE);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_word_wrap"), EDIT_TOGGLE_WORD_WRAP);
edit_menu->get_popup()->add_separator();
@@ -2395,6 +2399,8 @@ void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/unfold_all_lines", TTR("Unfold All Lines"), Key::NONE);
ED_SHORTCUT("script_text_editor/duplicate_selection", TTR("Duplicate Selection"), KeyModifierMask::SHIFT | KeyModifierMask::CTRL | Key::D);
ED_SHORTCUT_OVERRIDE("script_text_editor/duplicate_selection", "macos", KeyModifierMask::SHIFT | KeyModifierMask::META | Key::C);
+ ED_SHORTCUT("script_text_editor/duplicate_lines", TTR("Duplicate Lines"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::ALT | Key::DOWN);
+ ED_SHORTCUT_OVERRIDE("script_text_editor/duplicate_lines", "macos", KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::DOWN);
ED_SHORTCUT("script_text_editor/evaluate_selection", TTR("Evaluate Selection"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::E);
ED_SHORTCUT("script_text_editor/toggle_word_wrap", TTR("Toggle Word Wrap"), KeyModifierMask::ALT | Key::Z);
ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::ALT | Key::T);
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index 0efe7d54e3..8c0ba6d7e6 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -126,6 +126,7 @@ class ScriptTextEditor : public ScriptEditorBase {
EDIT_UNINDENT,
EDIT_DELETE_LINE,
EDIT_DUPLICATE_SELECTION,
+ EDIT_DUPLICATE_LINES,
EDIT_PICK_COLOR,
EDIT_TO_UPPERCASE,
EDIT_TO_LOWERCASE,
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);
diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h
index d1aa2a9047..a4ec2d882b 100644
--- a/editor/plugins/text_editor.h
+++ b/editor/plugins/text_editor.h
@@ -71,6 +71,7 @@ private:
EDIT_UNINDENT,
EDIT_DELETE_LINE,
EDIT_DUPLICATE_SELECTION,
+ EDIT_DUPLICATE_LINES,
EDIT_TO_UPPERCASE,
EDIT_TO_LOWERCASE,
EDIT_CAPITALIZE,
diff --git a/editor/plugins/text_shader_editor.cpp b/editor/plugins/text_shader_editor.cpp
index b68b283a61..27f42608c6 100644
--- a/editor/plugins/text_shader_editor.cpp
+++ b/editor/plugins/text_shader_editor.cpp
@@ -671,6 +671,9 @@ void TextShaderEditor::_menu_option(int p_option) {
case EDIT_DUPLICATE_SELECTION: {
shader_editor->duplicate_selection();
} break;
+ case EDIT_DUPLICATE_LINES: {
+ shader_editor->get_text_editor()->duplicate_lines();
+ } break;
case EDIT_TOGGLE_WORD_WRAP: {
TextEdit::LineWrappingMode wrap = shader_editor->get_text_editor()->get_line_wrapping_mode();
shader_editor->get_text_editor()->set_line_wrapping_mode(wrap == TextEdit::LINE_WRAPPING_BOUNDARY ? TextEdit::LINE_WRAPPING_NONE : TextEdit::LINE_WRAPPING_BOUNDARY);
@@ -1122,6 +1125,7 @@ TextShaderEditor::TextShaderEditor() {
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/delete_line"), EDIT_DELETE_LINE);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);
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_separator();
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("ui_text_completion_query"), EDIT_COMPLETE);
diff --git a/editor/plugins/text_shader_editor.h b/editor/plugins/text_shader_editor.h
index 03827f1b83..eba2ec0bb9 100644
--- a/editor/plugins/text_shader_editor.h
+++ b/editor/plugins/text_shader_editor.h
@@ -120,6 +120,7 @@ class TextShaderEditor : public MarginContainer {
EDIT_UNINDENT,
EDIT_DELETE_LINE,
EDIT_DUPLICATE_SELECTION,
+ EDIT_DUPLICATE_LINES,
EDIT_TOGGLE_WORD_WRAP,
EDIT_TOGGLE_COMMENT,
EDIT_COMPLETE,