Add Duplicate Lines shortcut to CodeTextEditor

This keyboard shortcut has been made with inspiration from the VS Code keyboard shortcut editor.action.copyLinesDownAction. It duplicates all selected lines and inserts them below no matter where the caret is within the line.
This commit is contained in:
PucklaMotzer09 2022-09-28 17:09:45 +02:00 committed by PucklaJ
parent 43b9e89a07
commit d2e651f403
11 changed files with 174 additions and 0 deletions

View file

@ -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) {