=== modified file 'plugin/UltiSnips.vim' --- old/plugin/UltiSnips.vim 2009-10-13 07:56:12 +0000 +++ new/plugin/UltiSnips.vim 2010-07-11 21:07:19 +0000 @@ -40,12 +40,23 @@ " }}} "" FUNCTIONS {{{ +function! CompensateForPUM() + """ The CursorMovedI event is not triggered while the popup-menu is visible, + """ and it's by this event that UltiSnips updates its vim-state. The fix is + """ to explicitly check for the presence of the popup menu, and update + """ the vim-state accordingly. + if pumvisible() + py UltiSnips_Manager.cursor_moved() + endif +endfunction + function! UltiSnips_ExpandSnippet() py UltiSnips_Manager.expand() return "" endfunction function! UltiSnips_ExpandSnippetOrJump() + call CompensateForPUM() py UltiSnips_Manager.expand_or_jump() return "" endfunction @@ -56,11 +67,13 @@ endfunction function! UltiSnips_JumpBackwards() + call CompensateForPUM() py UltiSnips_Manager.jump_backwards() return "" endfunction function! UltiSnips_JumpForwards() + call CompensateForPUM() py UltiSnips_Manager.jump_forwards() return "" endfunction === modified file 'test.py' --- old/test.py 2009-10-13 07:56:12 +0000 +++ new/test.py 2010-07-11 20:33:26 +0000 @@ -1059,6 +1059,24 @@ wanted = "superkallifragilistik\nsuperkallifragilistik some more " \ "superkallifragilistik some more" +# We need >2 different words with identical starts to create the +# popup-menu: +COMPLETION_OPTIONS = "completion1\ncompletion2\n" + +class Completion_ForwardsJumpWithoutCOMPL_ACCEPT(_VimTest): + # completions should not be truncated when JF is activated without having + # pressed COMPL_ACCEPT (Bug #598903) + snippets = ("test", "$1 $2") + keys = COMPLETION_OPTIONS + "test" + EX + "com" + COMPL_KW + JF + "foo" + wanted = COMPLETION_OPTIONS + "completion1 foo" + +class Completion_BackwardsJumpWithoutCOMPL_ACCEPT(_VimTest): + # completions should not be truncated when JB is activated without having + # pressed COMPL_ACCEPT (Bug #598903) + snippets = ("test", "$1 $2") + keys = COMPLETION_OPTIONS + "test" + EX + "foo" + JF + "com" + COMPL_KW + \ + JB + "foo" + wanted = COMPLETION_OPTIONS + "foo completion1" ################### # SNIPPET OPTIONS #