|
@@ -1225,8 +1225,13 @@ void ScriptTextEditor::_edit_option(int p_op) {
|
|
code_editor->duplicate_selection();
|
|
code_editor->duplicate_selection();
|
|
} break;
|
|
} break;
|
|
case EDIT_TOGGLE_FOLD_LINE: {
|
|
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();
|
|
tx->queue_redraw();
|
|
} break;
|
|
} break;
|