Takeshi NISHIDA avatar Takeshi NISHIDA committed a3fbe02

Fixed a bug that a wasted character was inserted after snipMate's trigger completion.

Comments (0)

Files changed (2)

 "
 function acp#completeSnipmate(findstart, base)
   if a:findstart
-    return len(matchstr(s:getCurrentText(), '.*\U'))
+    let s:posSnipmateCompletion = len(matchstr(s:getCurrentText(), '.*\U'))
+    return s:posSnipmateCompletion
   endif
   let lenBase = len(a:base)
   let items = filter(GetSnipsInCurrentScope(),
         \            'strpart(v:key, 0, lenBase) ==? a:base')
-  return map(items(items), 's:makeSnipmateItem(v:val[0], v:val[1])')
+  return map(sort(items(items)), 's:makeSnipmateItem(v:val[0], v:val[1])')
 endfunction
 
 "
 function acp#onPopupCloseSnipmate()
-  let text = s:getCurrentText()
-  let lenText = len(text)
+  let word = s:getCurrentText()[s:posSnipmateCompletion :]
   for trigger in keys(GetSnipsInCurrentScope())
-    let lenTrigger = len(trigger)
-    if lenText >= lenTrigger && strridx(text, trigger) + lenTrigger == lenText
+    if word ==# trigger
       call feedkeys("\<C-r>=TriggerSnippet()\<CR>", "n")
       return 0
     endif
 ==============================================================================
 CHANGELOG                                                      *acp-changelog*
 
+2.12.2
+  - Changed to sort snipMate's triggers.
+  - Fixed a bug that a wasted character was inserted after snipMate's trigger
+    completion.
+
 2.12.1
   - Changed to avoid a strange behavior with Microsoft IME.
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.