Skip to content

Commit 92c14e4

Browse files
committed
Use a timeout of 5s for searchpairpos
The timeout is supported with Vim 7.3.429 at least. In case of issues (breaking older Vims), this could be wrapped to fallback to some (higher) max offset. Fixes #64.
1 parent e0be8bf commit 92c14e4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

indent/python.vim

+2-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if !exists('g:python_pep8_indent_multiline_string')
3434
let g:python_pep8_indent_multiline_string = 0
3535
endif
3636

37-
let s:maxoff = 50
37+
let s:search_timeout = 5000
3838
let s:block_rules = {
3939
\ '^\s*elif\>': ['if', 'elif'],
4040
\ '^\s*except\>': ['try', 'except'],
@@ -105,15 +105,13 @@ function! s:find_opening_paren(...)
105105
return ret
106106
endif
107107

108-
let stopline = max([0, line('.') - s:maxoff])
109-
110108
" Return if cursor is in a comment.
111109
exe 'if' s:skip_search '| return [0, 0] | endif'
112110

113111
let positions = []
114112
for p in s:paren_pairs
115113
call add(positions, searchpairpos(
116-
\ '\V'.p[0], '', '\V'.p[1], 'bnW', s:skip_special_chars, stopline))
114+
\ '\V'.p[0], '', '\V'.p[1], 'bnW', s:skip_special_chars, 1, s:search_timeout))
117115
endfor
118116

119117
" Remove empty matches and return the type with the closest match

0 commit comments

Comments
 (0)