Fix #309 snippet range problem

This commit is contained in:
Shougo Matsushita 2015-12-23 20:20:24 +09:00
parent ff5d9e44ad
commit 5b8038e5d3

View File

@ -224,6 +224,11 @@ function! neosnippet#view#_get_snippet_range(begin_line, begin_patterns, end_lin
else else
let begin = searchpos('^' . neosnippet#util#escape_pattern( let begin = searchpos('^' . neosnippet#util#escape_pattern(
\ a:begin_patterns[0]) . '$', 'bnW')[0] \ a:begin_patterns[0]) . '$', 'bnW')[0]
if begin > 0 && a:begin_line == a:end_line
call setpos('.', pos)
return [begin + 1, begin + 1]
endif
if begin <= 0 if begin <= 0
let begin = line('.') - 50 let begin = line('.') - 50
endif endif
@ -232,10 +237,6 @@ function! neosnippet#view#_get_snippet_range(begin_line, begin_patterns, end_lin
let begin = 1 let begin = 1
endif endif
if a:begin_line == a:end_line
return [begin, begin]
endif
call cursor(a:end_line, 0) call cursor(a:end_line, 0)
if empty(a:end_patterns) if empty(a:end_patterns)
let end = line('.') + 50 let end = line('.') + 50