|
1 |
| -" Python-mode foldingfunctions |
| 1 | +k" Python-mode foldingfunction2 |
2 | 2 | " Notice that folding is based on single line so complex regular expressions
|
3 | 3 | " that take previous line into consideration are not fit for the job.
|
4 | 4 |
|
@@ -156,10 +156,14 @@ fun! s:BlockStart(line_number) "{{{
|
156 | 156 | " In case the end of the block is indented to a higher level than the def
|
157 | 157 | " statement plus one shiftwidth, we need to find the indent level at the
|
158 | 158 | " 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') |
160 | 164 | if previous_definition!= [0,0]
|
161 | 165 | 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') |
163 | 167 | callcursor(previous_definition[0]-1,0)
|
164 | 168 | endwhile
|
165 | 169 | endif
|
|