Skip to content

Commit 126b09b

Browse files
authored
Merge pull request python-mode#868 from jennaliu/develop
Fix python-mode#826 "Pymode seems to freeze on opening a very simple file and trying to source folding.vim"
2 parents 585b369 + 02a6e69 commit 126b09b

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

autoload/pymode/folding.vim

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -228,17 +228,11 @@ fun! s:BlockStart(lnum) "{{{
228228
" W: don't Wrap around the end of the file
229229
let previous_definition = searchpos(s:def_regex, 'bnW')
230230

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]
235-
" Lines that are blank have zero indent.
236-
while previous_definition != [0, 0]
237-
\ && indent(previous_definition[0]) >= l:inferred_indent
238-
let previous_definition = searchpos(s:def_regex, 'bnW')
239-
call cursor(previous_definition[0] - 1, 0)
240-
endwhile
241-
endif
231+
while previous_definition[0] != 1 && previous_definition != [0, 0]
232+
\ && indent(previous_definition[0]) >= l:inferred_indent
233+
let previous_definition = searchpos(s:def_regex, 'bnW')
234+
call cursor(previous_definition[0] - 1, 0)
235+
endwhile
242236
let last_def = previous_definition[0]
243237
if last_def
244238
call cursor(last_def, 0)

0 commit comments

Comments
 (0)