Merge pull request #73704 from KoBeWi/script_origami
Fix line folding with multiple carets
This commit is contained in:
commit
9b774ef350
2 changed files with 14 additions and 4 deletions
|
@ -1225,8 +1225,13 @@ void ScriptTextEditor::_edit_option(int p_op) {
|
|||
code_editor->duplicate_selection();
|
||||
} break;
|
||||
case EDIT_TOGGLE_FOLD_LINE: {
|
||||
for (int caret_idx = 0; caret_idx < tx->get_caret_count(); caret_idx++) {
|
||||
tx->toggle_foldable_line(tx->get_caret_line(caret_idx));
|
||||
int previous_line = -1;
|
||||
for (int caret_idx : tx->get_caret_index_edit_order()) {
|
||||
int line_idx = tx->get_caret_line(caret_idx);
|
||||
if (line_idx != previous_line) {
|
||||
tx->toggle_foldable_line(line_idx);
|
||||
previous_line = line_idx;
|
||||
}
|
||||
}
|
||||
tx->queue_redraw();
|
||||
} break;
|
||||
|
|
|
@ -397,8 +397,13 @@ void TextEditor::_edit_option(int p_op) {
|
|||
code_editor->duplicate_selection();
|
||||
} break;
|
||||
case EDIT_TOGGLE_FOLD_LINE: {
|
||||
for (int caret_idx = 0; caret_idx < tx->get_caret_count(); caret_idx++) {
|
||||
tx->toggle_foldable_line(tx->get_caret_line(caret_idx));
|
||||
int previous_line = -1;
|
||||
for (int caret_idx : tx->get_caret_index_edit_order()) {
|
||||
int line_idx = tx->get_caret_line(caret_idx);
|
||||
if (line_idx != previous_line) {
|
||||
tx->toggle_foldable_line(line_idx);
|
||||
previous_line = line_idx;
|
||||
}
|
||||
}
|
||||
tx->queue_redraw();
|
||||
} break;
|
||||
|
|
Loading…
Reference in a new issue