File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -79,14 +79,18 @@ 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])
8892 if a: lnum == fold_end
89- return ' s1'
93+ return next_def ? ' s1' : 0
9094 else
9195 return ' ='
9296 endif
You can’t perform that action at this time.
0 commit comments