0
0
mirror of https://github.com/vim/vim.git synced 2025-10-06 05:44:14 -04:00

patch 8.2.3337: completing "call g:" returns entries with just "g:"

Problem:    Completing "call g:" returns entries with just "g:". (Naohiro Ono)
Solution:   Skip empty strings returned by get_user_func_name(). (closes #8753)
This commit is contained in:
Bram Moolenaar
2021-08-13 17:48:25 +02:00
parent 92f05f21af
commit 069f90852f
3 changed files with 8 additions and 1 deletions

View File

@@ -2304,7 +2304,7 @@ get_function_name(expand_T *xp, int idx)
if (intidx < 0) if (intidx < 0)
{ {
name = get_user_func_name(xp, idx); name = get_user_func_name(xp, idx);
if (name != NULL) if (name != NULL && *name != NUL)
{ {
if (*name != '<' && STRNCMP("g:", xp->xp_pattern, 2) == 0) if (*name != '<' && STRNCMP("g:", xp->xp_pattern, 2) == 0)
return cat_prefix_varname('g', name); return cat_prefix_varname('g', name);

View File

@@ -657,6 +657,11 @@ func Test_cmdline_complete_user_func()
" g: prefix also works " g: prefix also works
call feedkeys(":echo g:Test_cmdline_complete_user_f\<Tab>\<Home>\"\<cr>", 'tx') call feedkeys(":echo g:Test_cmdline_complete_user_f\<Tab>\<Home>\"\<cr>", 'tx')
call assert_match('"echo g:Test_cmdline_complete_user_func', @:) call assert_match('"echo g:Test_cmdline_complete_user_func', @:)
" using g: prefix does not result in just "g:" matches from a lambda
let Fx = { a -> a }
call feedkeys(":echo g:\<Tab>\<Home>\"\<cr>", 'tx')
call assert_match('"echo g:[A-Z]', @:)
endfunc endfunc
func Test_cmdline_complete_user_names() func Test_cmdline_complete_user_names()

View File

@@ -755,6 +755,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 */
/**/
3337,
/**/ /**/
3336, 3336,
/**/ /**/