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) "{{{
79
79
" own fold. If the class/def containing the current line is on
8000
tr>80
80
" the first line it can't be nested, and if the this block
81
81
" 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.
84
87
if next_def_indent < last_block_indent && last_block > 1 && last_block_end < line (' $' )
88
+ \ && indent (nextnonblank (last_block_end)) >= last_block_indent
85
89
86
90
" Include up to one blank line in the fold
87
91
let fold_end = min ([prevnonblank (last_block_end - 1 ) + 1 , last_block_end])
88
92
if a: lnum == fold_end
89
- return ' s1'
93
+ return next_def ? ' s1' : 0
90
94
else
91
95
return ' ='
92
96
endif
You can’t perform that action at this time.
0 commit comments