summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornaohiro ono <obcat@icloud.com>2021-08-19 21:20:41 +0200
committerBram Moolenaar <Bram@vim.org>2021-08-19 21:20:41 +0200
commit5aec755b678cfd434b8ea2158d06992f33e1ff80 (patch)
treec9f19e9f5aed0047762772dedae8db831cfb7776
parentc66f645b809d0852592ca37afacb9031b5950c7f (diff)
patch 8.2.3360: user function completion fails with dict functionv8.2.3360
Problem: User function completion fails with dict function. Solution: Do not stop sequencing through the list if user functions when encountering an empty name. (Naohiro Ono, closes #8765, closes #8774)
-rw-r--r--src/evalfunc.c5
-rw-r--r--src/testdir/test_cmdline.vim10
-rw-r--r--src/version.c2
3 files changed, 14 insertions, 3 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 4d73d40f12..d6fb03ee40 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -2307,9 +2307,10 @@ get_function_name(expand_T *xp, int idx)
if (intidx < 0)
{
name = get_user_func_name(xp, idx);
- if (name != NULL && *name != NUL)
+ if (name != NULL)
{
- if (*name != '<' && STRNCMP("g:", xp->xp_pattern, 2) == 0)
+ if (*name != NUL && *name != '<'
+ && STRNCMP("g:", xp->xp_pattern, 2) == 0)
return cat_prefix_varname('g', name);
return name;
}
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 5d91952443..d04bb4c8cb 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -650,7 +650,7 @@ endfunc
func Test_cmdline_complete_user_func()
call feedkeys(":func Test_cmdline_complete_user\<Tab>\<Home>\"\<cr>", 'tx')
- call assert_match('"func Test_cmdline_complete_user', @:)
+ call assert_match('"func Test_cmdline_complete_user_', @:)
call feedkeys(":func s:ScriptL\<Tab>\<Home>\"\<cr>", 'tx')
call assert_match('"func <SNR>\d\+_ScriptLocalFunction', @:)
@@ -662,6 +662,14 @@ func Test_cmdline_complete_user_func()
let Fx = { a -> a }
call feedkeys(":echo g:\<Tab>\<Home>\"\<cr>", 'tx')
call assert_match('"echo g:[A-Z]', @:)
+
+ " existence of script-local dict function does not break user function name
+ " completion
+ function s:a_dict_func() dict
+ endfunction
+ call feedkeys(":call Test_cmdline_complete_user\<Tab>\<Home>\"\<cr>", 'tx')
+ call assert_match('"call Test_cmdline_complete_user_', @:)
+ delfunction s:a_dict_func
endfunc
func Test_cmdline_complete_user_names()
diff --git a/src/version.c b/src/version.c
index b47b1e3581..2d890f83c3 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3360,
+/**/
3359,
/**/
3358,