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

Commit8aeb039

Browse files
committed
Fixed corner case of folding crash when there is a definition on the first line (gh issuepython-mode#839)
1 parent0b3bbad commit8aeb039

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎autoload/pymode/folding.vim

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ fun! pymode#folding#foldcase(lnum) "{{{
207207
endfunction"}}}
208208

209209
fun!s:BlockStart(lnum)"{{{
210-
" Returns the definition statement which encloses the current line.
210+
" Returns the definition statementlinewhich encloses the current line.
211211

212212
letline=getline(a:lnum)
213213
ifline!~s:blank_regex
@@ -227,7 +227,11 @@ fun! s:BlockStart(lnum) "{{{
227227
" n: do Not move the cursor
228228
" W: don't Wrap around the end of the file
229229
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]
231235
" Lines that are blank have zero indent.
232236
while previous_definition!= [0,0]
233237
\&&indent(previous_definition[0])>=l:inferred_indent

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp