1
0
forked from aniani/vim

patch 7.4.2162

Problem:    Result of getcompletion('', 'sign') depends on previous
            completion.
Solution:   Call set_context_in_sign_cmd(). (Dominique Pelle)
This commit is contained in:
Bram Moolenaar
2016-08-06 14:12:50 +02:00
parent 7ab6defcaf
commit 7522f69821
3 changed files with 22 additions and 3 deletions

View File

@@ -4247,6 +4247,13 @@ f_getcompletion(typval_T *argvars, typval_T *rettv)
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern); xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
} }
#endif #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); pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL)) if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL))

View File

@@ -138,6 +138,19 @@ func Test_getcompletion()
call assert_equal(keys, l) call assert_equal(keys, l)
endif 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 \<c-d>\<c-c>", '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. " For others test if the name is recognized.
let names = ['buffer', 'environment', 'file_in_path', let names = ['buffer', 'environment', 'file_in_path',
\ 'mapping', 'shellcmd', 'tag', 'tag_listfiles', 'user'] \ 'mapping', 'shellcmd', 'tag', 'tag_listfiles', 'user']
@@ -150,9 +163,6 @@ func Test_getcompletion()
if has('profile') if has('profile')
call add(names, 'syntime') call add(names, 'syntime')
endif endif
if has('signs')
call add(names, 'sign')
endif
set tags=Xtags set tags=Xtags
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", "word\tfile\tcmd"], 'Xtags') call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", "word\tfile\tcmd"], 'Xtags')

View File

@@ -763,6 +763,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2162,
/**/ /**/
2161, 2161,
/**/ /**/