# HG changeset patch # User Christian Brabandt # Date 1470422706 -7200 # Node ID be9b5f8c3fd9857766e43e39c50666c4ee43229b # Parent d2fe50232d72d1fb35da4222812b09aa61bcdfdb commit https://github.com/vim/vim/commit/b650b9878e9f0ac6bb1b61230095ad9ab3850a33 Author: Bram Moolenaar Date: Fri Aug 5 20:35:13 2016 +0200 patch 7.4.2158 Problem: Result of getcompletion('', 'cscope') depends on previous completion. (Christian Brabandt) Solution: Call set_context_in_cscope_cmd(). diff --git a/src/evalfunc.c b/src/evalfunc.c --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -4240,6 +4240,13 @@ f_getcompletion(typval_T *argvars, typva 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)) diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -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 \\", '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 diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -764,6 +764,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2158, +/**/ 2157, /**/ 2156,