]> granicus.if.org Git - vim/commitdiff
patch 7.4.2158 v7.4.2158
authorBram Moolenaar <Bram@vim.org>
Fri, 5 Aug 2016 18:35:13 +0000 (20:35 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 5 Aug 2016 18:35:13 +0000 (20:35 +0200)
Problem:    Result of getcompletion('', 'cscope') depends on previous
            completion. (Christian Brabandt)
Solution:   Call set_context_in_cscope_cmd().

src/evalfunc.c
src/testdir/test_cmdline.vim
src/version.c

index b6f05b14cb46a793980f81eff36db051a9cdf51b..00956612f8d9d2584c4f52470c1edfd88166ed57 100644 (file)
@@ -4240,6 +4240,13 @@ f_getcompletion(typval_T *argvars, typval_T *rettv)
        xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
     }
 # endif
+#ifdef FEAT_CSCOPE
+    if (xpc.xp_context == EXPAND_CSCOPE)
+    {
+       set_context_in_cscope_cmd(&xpc, xpc.xp_pattern, CMD_cscope);
+       xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
+    }
+#endif
 
     pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
     if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL))
index c6d416f1e600b3eee848c5163fcd05c9d463c442..12194cd963873dec09fd6ead6c453781c45fa715 100644 (file)
@@ -125,12 +125,22 @@ func Test_getcompletion()
   let l = getcompletion('dark', 'highlight')
   call assert_equal([], l)
 
+  if has('cscope')
+    let l = getcompletion('', 'cscope')
+    let cmds = ['add', 'find', 'help', 'kill', 'reset', 'show']
+    call assert_equal(cmds, l)
+    " using cmdline completion must not change the result
+    call feedkeys(":cscope find \<c-d>\<c-c>", 'xt')
+    let l = getcompletion('', 'cscope')
+    call assert_equal(cmds, l)
+    let keys = ['a', 'c', 'd', 'e', 'f', 'g', 'i', 's', 't']
+    let l = getcompletion('find ', 'cscope')
+    call assert_equal(keys, l)
+  endif
+
   " For others test if the name is recognized.
   let names = ['buffer', 'environment', 'file_in_path',
        \ 'mapping', 'shellcmd', 'tag', 'tag_listfiles', 'user']
-  if has('cscope')
-    call add(names, 'cscope')
-  endif
   if has('cmdline_hist')
     call add(names, 'history')
   endif
index c5511beeb34ed023ca827423f58f27481e373c68..31aa1e9a2e5be58496438e9e7d9ce2c5b3910a62 100644 (file)
@@ -763,6 +763,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2158,
 /**/
     2157,
 /**/