diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-08-20 15:25:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-20 15:25:28 +0200 |
commit | f4e2baae7fa54f2501818be4bc7963995fe427fd (patch) | |
tree | e19ef02b68b82fb322351bd6205275c19a110e96 /editor | |
parent | 20ab8c11567c6edadb26292ce99367281f251d4e (diff) | |
parent | de95e65d109b49488bbba7d3a741bb0e81d1123b (diff) |
Merge pull request #10476 from Paulb23/delete_current_line_issue_9643
Delete current line, issue 9643
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 17 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 1aa9f04484..1a3092b6e4 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -867,6 +867,21 @@ void ScriptTextEditor::_edit_option(int p_op) { //tx->deselect(); } break; + case EDIT_DELETE_LINE: { + + TextEdit *tx = code_editor->get_text_edit(); + Ref<Script> scr = get_edited_script(); + if (scr.is_null()) + return; + + tx->begin_complex_operation(); + int line = tx->cursor_get_line(); + tx->set_line(tx->cursor_get_line(), ""); + tx->backspace_at_cursor(); + tx->cursor_set_line(line); + tx->end_complex_operation(); + + } break; case EDIT_CLONE_DOWN: { TextEdit *tx = code_editor->get_text_edit(); @@ -1392,6 +1407,7 @@ ScriptTextEditor::ScriptTextEditor() { edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_down"), EDIT_MOVE_LINE_DOWN); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT); + 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/clone_down"), EDIT_CLONE_DOWN); edit_menu->get_popup()->add_separator(); @@ -1466,6 +1482,7 @@ void ScriptTextEditor::register_editor() { ED_SHORTCUT("script_text_editor/select_all", TTR("Select All"), KEY_MASK_CMD | KEY_A); ED_SHORTCUT("script_text_editor/move_up", TTR("Move Up"), KEY_MASK_ALT | KEY_UP); ED_SHORTCUT("script_text_editor/move_down", TTR("Move Down"), KEY_MASK_ALT | KEY_DOWN); + ED_SHORTCUT("script_text_editor/delete_line", TTR("Delete Line"), KEY_MASK_CTRL | KEY_MASK_SHIFT | KEY_K); //leave these at zero, same can be accomplished with tab/shift-tab, including selection //the next/previous in history shortcut in this case makes a lot more sene. diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index e55847832f..c505976223 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -74,6 +74,7 @@ class ScriptTextEditor : public ScriptEditorBase { EDIT_MOVE_LINE_DOWN, EDIT_INDENT_RIGHT, EDIT_INDENT_LEFT, + EDIT_DELETE_LINE, EDIT_CLONE_DOWN, EDIT_PICK_COLOR, EDIT_TO_UPPERCASE, |