Merge pull request #63113 from snailrhymer/3.x-folding-comment-fix

This commit is contained in:
Rémi Verschelde 2022-08-08 15:54:57 +02:00 committed by GitHub
commit f30a2c1292
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -6341,7 +6341,8 @@ void TextEdit::fold_line(int p_line) {
int last_line = start_indent; int last_line = start_indent;
for (int i = p_line + 1; i < text.size(); i++) { for (int i = p_line + 1; i < text.size(); i++) {
if (text[i].strip_edges().size() != 0) { if (text[i].strip_edges().size() != 0) {
if (is_line_comment(i)) { if (is_line_comment(i) && get_indent_level(i) <= start_indent) {
// Checked indent to make sure indented comments that finish a code block are folded.
continue; continue;
} else if (get_indent_level(i) > start_indent) { } else if (get_indent_level(i) > start_indent) {
last_line = i; last_line = i;