Skip to content

Fix #826 #868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 27, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions autoload/pymode/folding.vim
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,11 @@ fun! s:BlockStart(lnum) "{{{
" W: don't Wrap around the end of the file
let previous_definition = searchpos(s:def_regex, 'bnW')

" Corner case of function being defined on the first line.
if previous_definition[0] == 1
" Just skip the while loop.
elseif previous_definition != [0, 0]
" Lines that are blank have zero indent.
while previous_definition != [0, 0]
\ && indent(previous_definition[0]) >= l:inferred_indent
let previous_definition = searchpos(s:def_regex, 'bnW')
call cursor(previous_definition[0] - 1, 0)
endwhile
endif
while previous_definition[0] != 1 && previous_definition != [0, 0]
\ && indent(previous_definition[0]) >= l:inferred_indent
let previous_definition = searchpos(s:def_regex, 'bnW')
call cursor(previous_definition[0] - 1, 0)
endwhile
let last_def = previous_definition[0]
if last_def
call cursor(last_def, 0)
Expand Down