File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -207,7 +207,7 @@ fun! pymode#folding#foldcase(lnum) "{{{
207
207
endfunction " }}}
208
208
209
209
fun ! s: BlockStart (lnum) " {{{
210
- " Returns the definition statement which encloses the current line.
210
+ " Returns the definition statement line which encloses the current line.
211
211
212
212
let line = getline (a: lnum )
213
213
if line !~ s: blank_regex
@@ -227,7 +227,11 @@ fun! s:BlockStart(lnum) "{{{
227
227
" n: do Not move the cursor
228
228
" W: don't Wrap around the end of the file
229
229
let previous_definition = searchpos (s: def_regex , ' bnW' )
230
- if previous_definition != [0 , 0 ]
230
+
231
+ " Corner case of function being defined on the first line.
232
+ if previous_definition[0 ] == 1
233
+ " Just skip the while loop.
234
+ elseif previous_definition != [0 , 0 ]
231
235
" Lines that are blank have zero indent.
232
236
while previous_definition != [0 , 0 ]
233
237
\ && indent (previous_definition[0 ]) >= l: inferred_indent
You can’t perform that action at this time.
0 commit comments