Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc7e6baa

Browse files
committed
fixed folding issue when definition was on first line (gh issue 808)
1 parent76c582b commitc7e6baa

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

‎autoload/pymode/folding.vim

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
" Python-mode foldingfunctions
1+
k" Python-mode foldingfunction2
22
" Notice that folding is based on single line so complex regular expressions
33
" that take previous line into consideration are not fit for the job.
44

@@ -156,10 +156,14 @@ fun! s:BlockStart(line_number) "{{{
156156
" In case the end of the block is indented to a higher level than the def
157157
" statement plus one shiftwidth, we need to find the indent level at the
158158
" bottom of that if/for/try/while/etc. block.
159-
let previous_definition=searchpos(s:def_regex,'bcnW')
159+
" Flags from searchpos() (same as search()):
160+
" b: search Backward instead of forward
161+
" n: do Not move the cursor
162+
" W: don't Wrap around the end of the file
163+
let previous_definition=searchpos(s:def_regex,'bnW')
160164
if previous_definition!= [0,0]
161165
while previous_definition!= [0,0]&&indent(previous_definition[0])>=indent(a:line_number)
162-
let previous_definition=searchpos(s:def_regex,'bncW')
166+
let previous_definition=searchpos(s:def_regex,'bnW')
163167
callcursor(previous_definition[0]-1,0)
164168
endwhile
165169
endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp