From 7522f6982197f83a5c0f6e9af07fb713934f824a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 6 Aug 2016 14:12:50 +0200 Subject: patch 7.4.2162 Problem: Result of getcompletion('', 'sign') depends on previous completion. Solution: Call set_context_in_sign_cmd(). (Dominique Pelle) --- src/evalfunc.c | 7 +++++++ src/testdir/test_cmdline.vim | 16 +++++++++++++--- src/version.c | 2 ++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/evalfunc.c b/src/evalfunc.c index dc0e630af..375453446 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -4247,6 +4247,13 @@ f_getcompletion(typval_T *argvars, typval_T *rettv) xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern); } #endif +#ifdef FEAT_SIGNS + if (xpc.xp_context == EXPAND_SIGN) + { + set_context_in_sign_cmd(&xpc, xpc.xp_pattern); + 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 index 12194cd96..e2c187693 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -138,6 +138,19 @@ func Test_getcompletion() call assert_equal(keys, l) endif + if has('signs') + sign define Testing linehl=Comment + let l = getcompletion('', 'sign') + let cmds = ['define', 'jump', 'list', 'place', 'undefine', 'unplace'] + call assert_equal(cmds, l) + " using cmdline completion must not change the result + call feedkeys(":sign list \\", 'xt') + let l = getcompletion('', 'sign') + call assert_equal(cmds, l) + let l = getcompletion('list ', 'sign') + call assert_equal(['Testing'], l) + endif + " For others test if the name is recognized. let names = ['buffer', 'environment', 'file_in_path', \ 'mapping', 'shellcmd', 'tag', 'tag_listfiles', 'user'] @@ -150,9 +163,6 @@ func Test_getcompletion() if has('profile') call add(names, 'syntime') endif - if has('signs') - call add(names, 'sign') - endif set tags=Xtags call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", "word\tfile\tcmd"], 'Xtags') diff --git a/src/version.c b/src/version.c index e68df1f5a..bd2b16c7a 100644 --- a/src/version.c +++ b/src/version.c @@ -763,6 +763,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2162, /**/ 2161, /**/ -- cgit v1.2.1