diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-09-13 21:51:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-13 21:51:41 +0200 |
commit | 2a1807b12d16156e0d18f69c589cb5b4efef8f43 (patch) | |
tree | eafb811396bb9e25d98c0d422c3d2b2b71f859c0 /scene/gui | |
parent | 70ba36674351f9d585cf8ab80a2faa390b52da71 (diff) | |
parent | d647ba3540ee30b5c50083b1ad6f0263b110b785 (diff) |
Merge pull request #52517 from Paulb23/block-comment-folding
Fix block deliminator not-folding at end of file
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/code_edit.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp index d05762b6c0..bc962de698 100644 --- a/scene/gui/code_edit.cpp +++ b/scene/gui/code_edit.cpp @@ -1407,9 +1407,14 @@ void CodeEdit::fold_line(int p_line) { int in_string = (in_comment == -1) ? is_in_string(p_line) : -1; if (in_string != -1 || in_comment != -1) { end_line = get_delimiter_end_position(p_line, get_line(p_line).size() - 1).y; - /* End line is the same therefore we have a block. */ + /* End line is the same therefore we have a block of single line delimiters. */ if (end_line == p_line) { for (int i = p_line + 1; i <= line_count; i++) { + if (i == line_count) { + end_line = line_count; + break; + } + if ((in_string != -1 && is_in_string(i) == -1) || (in_comment != -1 && is_in_comment(i) == -1)) { end_line = i - 1; break; |