1
0
mirror of https://github.com/gryf/snipmate.vim.git synced 2025-12-22 14:08:01 +01:00

fixed bug when cancelling a snippet with multiple matches

This commit is contained in:
Michael Sanders
2009-03-25 16:32:39 -04:00
parent 75b87b7473
commit 5a461cfb63

View File

@@ -120,7 +120,7 @@ fun s:ChooseSnippet(scope, trigger)
endfor endfor
if i == 2 | return s:multi_snips[a:scope][a:trigger][0][1] | endif if i == 2 | return s:multi_snips[a:scope][a:trigger][0][1] | endif
let num = inputlist(snippet) - 1 let num = inputlist(snippet) - 1
return num < i-1 ? s:multi_snips[a:scope][a:trigger][num][1] : '' return num == -1 ? '' : s:multi_snips[a:scope][a:trigger][num][1]
endf endf
fun! TriggerSnippet() fun! TriggerSnippet()
@@ -149,7 +149,7 @@ fun! TriggerSnippet()
" If word is a trigger for a snippet, delete the trigger & expand the snippet. " If word is a trigger for a snippet, delete the trigger & expand the snippet.
if exists('s:snippet') if exists('s:snippet')
if s:snippet == '' " If user cancelled a multi snippet, quit. if s:snippet == '' " If user cancelled a multi snippet, quit.
return unl s:snippet unl s:snippet | return ''
endif endif
let col = col('.') - len(trigger) let col = col('.') - len(trigger)
sil exe 's/'.escape(trigger, '.^$/\*[]').'\%#//' sil exe 's/'.escape(trigger, '.^$/\*[]').'\%#//'