File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed
Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change 1515
1616fun ! pymode#folding#text () " {{{
1717 let fs = v: foldstart
18- while getline (fs ) = ~ ' \%(^\s*@\)\|\%(^\s*\%("""\| '''''' \)\s*$\) '
18+ while getline (fs ) !~ s: def_regex && getline ( fs ) !~ s: doc_begin_regex
1919 let fs = nextnonblank (fs + 1 )
2020 endwhile
21+ if getline (fs ) = ~ s: doc_begin_regex
22+ let fs = nextnonblank (fs + 1 )
23+ endif
2124 let line = getline (fs )
2225
2326 let nucolwidth = &fdc + &number * &numberwidth
@@ -41,8 +44,24 @@ fun! pymode#folding#expr(lnum) "{{{
4144 let indent = indent (a: lnum )
4245 let prev_line = getline (a: lnum - 1 )
4346
44- if line = ~ s: def_regex || line = ~ s: decorator_regex
45- if prev_line = ~ s: decorator_regex
47+ if line = ~ s: decorator_regex
48+ return " >" .(indent / &shiftwidth + 1 )
49+ endif
50+
51+ if line = ~ s: def_regex
52+ " Check if last decorator is before the last def
53+ let decorated = 0
54+ let lnum = a: lnum - 1
55+ while lnum > 0
56+ if getline (lnum) = ~ s: def_regex
57+ break
58+ elseif getline (lnum) = ~ s: decorator_regex
59+ let decorated = 1
60+ break
61+ endif
62+ let lnum -= 1
63+ endwhile
64+ if decorated
4665 return ' ='
4766 else
4867 return " >" .(indent / &shiftwidth + 1 )
You can’t perform that action at this time.
0 commit comments