Merge pull request #61 from vinsonchuong/refactor-folding-fix

Simplified fix not working for some snippets
This commit is contained in:
Shougo 2012-10-28 02:54:47 -07:00
commit 77375e8fd3

View File

@ -570,15 +570,16 @@ function! neosnippet#expand(cur_text, col, trigger_name)"{{{
let next_col = len(snippet_lines[-1]) + 1 let next_col = len(snippet_lines[-1]) + 1
let snippet_lines[-1] = snippet_lines[-1] . next_line let snippet_lines[-1] = snippet_lines[-1] . next_line
if has('folding')
let foldmethod = &l:foldmethod
let &l:foldmethod = 'manual'
endif
call setline('.', snippet_lines[0]) call setline('.', snippet_lines[0])
if len(snippet_lines) > 1 if len(snippet_lines) > 1
call append('.', snippet_lines[1:]) call append('.', snippet_lines[1:])
endif endif
if has('folding')
silent! execute begin_line . ',' . end_line . 'foldopen!'
endif
call s:indent_snippet(begin_line, end_line) call s:indent_snippet(begin_line, end_line)
let begin_patterns = (begin_line > 1) ? let begin_patterns = (begin_line > 1) ?
@ -603,6 +604,10 @@ function! neosnippet#expand(cur_text, col, trigger_name)"{{{
call s:snippets_jump(a:cur_text, a:col) call s:snippets_jump(a:cur_text, a:col)
endif endif
if has('folding')
let &l:foldmethod = foldmethod
silent! execute begin_line . ',' . end_line . 'foldopen!'
endif
let &l:iminsert = 0 let &l:iminsert = 0
let &l:imsearch = 0 let &l:imsearch = 0
endfunction"}}} endfunction"}}}