Fix #308 nested snippet problem

This commit is contained in:
Shougo Matsushita 2015-12-19 12:16:36 +09:00
parent 1d5b8589b6
commit 824c0fbe98
2 changed files with 15 additions and 8 deletions

View File

@ -83,6 +83,9 @@ endfunction"}}}
function! neosnippet#get_placeholder_marker_substitute_pattern() "{{{
return '\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}'
endfunction"}}}
function! neosnippet#get_placeholder_marker_substitute_nonzero_pattern() "{{{
return '\${\([1-9]\d*\%(:.\{-}\)\?\\\@<!\)}'
endfunction"}}}
function! neosnippet#get_placeholder_marker_default_pattern() "{{{
return '<`\d\+:\zs.\{-}\ze\\\@<!`>'
endfunction"}}}

View File

@ -113,6 +113,7 @@ function! neosnippet#view#_insert(snippet, options, cur_text, col) "{{{
let end_patterns = (end_line < line('$')) ?
\ [getline(end_line + 1)] : []
call add(expand_stack, {
\ 'snippet' : a:snippet,
\ 'begin_line' : begin_line,
\ 'begin_patterns' : begin_patterns,
\ 'end_line' : end_line,
@ -152,14 +153,17 @@ function! neosnippet#view#_jump(_, col) "{{{
\ expand_info.end_patterns)
let begin_cnt = expand_info.holder_cnt
while (expand_info.holder_cnt - begin_cnt) < 5
" Next count.
let expand_info.holder_cnt += 1
if neosnippet#view#_search_snippet_range(
\ begin, end, expand_info.holder_cnt - 1)
return 1
endif
endwhile
if expand_info.snippet =~
\ neosnippet#get_placeholder_marker_substitute_nonzero_pattern()
while (expand_info.holder_cnt - begin_cnt) < 5
" Next count.
let expand_info.holder_cnt += 1
if neosnippet#view#_search_snippet_range(
\ begin, end, expand_info.holder_cnt - 1)
return 1
endif
endwhile
endif
" Search placeholder 0.
if neosnippet#view#_search_snippet_range(begin, end, 0)