Improve performance for skip

This commit is contained in:
Andy K. Massimino
2017-11-15 20:59:09 -05:00
parent f472a56042
commit 74403a2426
2 changed files with 22 additions and 4 deletions

View File

@@ -596,7 +596,7 @@ function! s:get_matching_delims(down) dict " {{{1
let l:open = matchup#delim#fill_backrefs(l:open, self.groups, 0)
let l:close = matchup#delim#fill_backrefs(l:close, self.groups, 0)
let l:skip = 'matchup#delim#skip()'
let l:skip = 'matchup#delim#skip0()'
if matchup#perf#timeout_check() | return [['', 0, 0]] | endif
@@ -1161,6 +1161,15 @@ function! matchup#delim#skip(...) " {{{1
execute 'return (' b:matchup_delim_skip ')'
endfunction
function! matchup#delim#skip0()
if empty(b:matchup_delim_skip)
return matchup#util#in_comment_or_string(line('.'), col('.'))
endif
let s:eff_curpos = [line('.'), col('.')]
execute 'return (' b:matchup_delim_skip ')'
endfunction
let s:eff_curpos = [1, 1]
" effective column/line

View File

@@ -12,9 +12,18 @@ function! matchup#pos#set_cursor(...) " {{{1
endfunction
" }}}1
function! matchup#pos#get_cursor() " {{{1
return exists('*getcurpos') ? getcurpos() : getpos('.')
endfunction
" function! matchup#pos#get_cursor() {{{1
if exists('*getcurpos')
function! matchup#pos#get_cursor()
return getcurpos()
endfunction
else
function! matchup#pos#get_cursor()
return getpos('.')
endfunction
endif
" }}}1
" }}}1
function! matchup#pos#get_cursor_line() " {{{1