diff options
author | Paulb23 <p_batty@hotmail.co.uk> | 2017-08-20 13:31:30 +0100 |
---|---|---|
committer | Paulb23 <p_batty@hotmail.co.uk> | 2017-08-20 13:31:30 +0100 |
commit | de95e65d109b49488bbba7d3a741bb0e81d1123b (patch) | |
tree | 6bc12c24d5bb451836d82282c1b53bc272d1597e /editor/plugins | |
parent | 7e5890d23d882547ae465fb7756b74be5bc1f62b (diff) |
Delete current line, issue 9643
Diffstat (limited to 'editor/plugins')
-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, |