You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-22 15:06:45 +00:00
Fix line folding with multiple carets
This commit is contained in:
@@ -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++) {
|
int previous_line = -1;
|
||||||
tx->toggle_foldable_line(tx->get_caret_line(caret_idx));
|
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;
|
||||||
|
|||||||
@@ -397,8 +397,13 @@ void TextEditor::_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++) {
|
int previous_line = -1;
|
||||||
tx->toggle_foldable_line(tx->get_caret_line(caret_idx));
|
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;
|
||||||
|
|||||||
Reference in New Issue
Block a user