Delete all selected lines using the delete line shortcut in script editor
(cherry picked from commit 7368978a48
)
This commit is contained in:
parent
e9d8dfbf0e
commit
3e8c214a19
1 changed files with 20 additions and 6 deletions
|
@ -935,13 +935,27 @@ void ScriptTextEditor::_edit_option(int p_op) {
|
||||||
Ref<Script> scr = get_edited_script();
|
Ref<Script> scr = get_edited_script();
|
||||||
if (scr.is_null())
|
if (scr.is_null())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tx->begin_complex_operation();
|
tx->begin_complex_operation();
|
||||||
int line = tx->cursor_get_line();
|
if (tx->is_selection_active()) {
|
||||||
tx->set_line(tx->cursor_get_line(), "");
|
int to_line = tx->get_selection_to_line();
|
||||||
tx->backspace_at_cursor();
|
int from_line = tx->get_selection_from_line();
|
||||||
tx->unfold_line(line);
|
int count = Math::abs(to_line - from_line) + 1;
|
||||||
tx->cursor_set_line(line);
|
while (count) {
|
||||||
|
tx->set_line(tx->cursor_get_line(), "");
|
||||||
|
tx->backspace_at_cursor();
|
||||||
|
count--;
|
||||||
|
if (count)
|
||||||
|
tx->unfold_line(from_line);
|
||||||
|
}
|
||||||
|
tx->cursor_set_line(from_line - 1);
|
||||||
|
tx->deselect();
|
||||||
|
} else {
|
||||||
|
int line = tx->cursor_get_line();
|
||||||
|
tx->set_line(tx->cursor_get_line(), "");
|
||||||
|
tx->backspace_at_cursor();
|
||||||
|
tx->unfold_line(line);
|
||||||
|
tx->cursor_set_line(line);
|
||||||
|
}
|
||||||
tx->end_complex_operation();
|
tx->end_complex_operation();
|
||||||
} break;
|
} break;
|
||||||
case EDIT_CLONE_DOWN: {
|
case EDIT_CLONE_DOWN: {
|
||||||
|
|
Loading…
Reference in a new issue