8000 Fix edge case bug at end of top-level fold · python-mode/python-mode@db26703 · GitHub
[go: up one dir, main page]

Skip to content

Commit db26703

Browse files
committed
Fix edge case bug at end of top-level fold
1 parent 906eff5 commit db26703

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

autoload/pymode/folding.vim

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,13 @@ fun! pymode#folding#expr(lnum) "{{{
7979
" own fold. If the class/def containing the current line is on
8080
" the first line it can't be nested, and if the this block
8181
" ends on the last line, it contains no trailing code that
82-
" should not be folded. Otherwise, we know the current line
83-
" is at the end of a nested def.
82+
" should not be folded. Finally, if the next non-blank line
83+
" after the end of the previous def is less indented than the
84+
" previous def, it is not part of the same fold as that def.
85+
" Otherwise, we know the current line is at the end of a
86+
" nested def.
8487
if next_def_indent < last_block_indent && last_block > 1 && last_block_end < line('$')
88+
\ && indent(nextnonblank(last_block_end)) >= last_block_indent
8589

8690
" Include up to one blank line in the fold
8791
let fold_end = min([prevnonblank(last_block_end - 1) + 1, last_block_end])

0 commit comments

Comments
 (0)
0