From c9d9d3a85d0d70a4485555458d8971ed8b4de50d Mon Sep 17 00:00:00 2001 From: Michael Sanders Date: Sun, 12 Jul 2009 19:50:44 -0400 Subject: [PATCH] fixed bug when switching buffers while on placeholder --- autoload/snipMate.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/autoload/snipMate.vim b/autoload/snipMate.vim index 3273d34..2a3435f 100644 --- a/autoload/snipMate.vim +++ b/autoload/snipMate.vim @@ -297,7 +297,9 @@ endf " It also automatically quits the snippet if the cursor is moved out of it " while in insert mode. fun s:UpdateChangedSnip(entering) - if exists('s:update') " If modifying a placeholder + if exists('g:snipPos') && bufnr(0) != s:lastBuf + call s:RemoveSnippet() + elseif exists('s:update') " If modifying a placeholder if !exists('s:origPos') && s:curPos + 1 < s:snipLen " Save the old snippet & word length before it's updated " s:startSnip must be saved too, in case text is added @@ -341,7 +343,6 @@ fun s:UpdateChangedSnip(entering) " Delete snippet if cursor moves out of it in insert mode if (lnum == s:endSnipLine && (col > s:endSnip || col < g:snipPos[s:curPos][1])) \ || lnum > s:endSnipLine || lnum < g:snipPos[s:curPos][0] - \ || bufnr(0) != s:lastBuf call s:RemoveSnippet() endif endif