aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2021-08-13 17:00:16 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2021-09-17 02:10:44 +0100
commit2ddfd6b9994d1d81b45f38e7e9a2e7ce0333c4e8 (patch)
tree6dfca5850e60243032a383b73e77b49a91ef3d13
parentb24c377c8ab3613c012076703fe72b7e8610f4ee (diff)
downloadrneovim-2ddfd6b9994d1d81b45f38e7e9a2e7ce0333c4e8.tar.gz
rneovim-2ddfd6b9994d1d81b45f38e7e9a2e7ce0333c4e8.tar.bz2
rneovim-2ddfd6b9994d1d81b45f38e7e9a2e7ce0333c4e8.zip
vim-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 vim/vim#8753) https://github.com/vim/vim/commit/069f90852f1444cac50491c10dfbd339a3f9e0c8
-rw-r--r--src/nvim/eval/funcs.c2
-rw-r--r--src/nvim/testdir/test_cmdline.vim5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index bcbd2266d3..2ab9801fab 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -119,7 +119,7 @@ char_u *get_function_name(expand_T *xp, int idx)
intidx = -1;
if (intidx < 0) {
name = get_user_func_name(xp, idx);
- if (name != NULL) {
+ if (name != NULL && *name != NUL) {
if (*name != '<' && STRNCMP("g:", xp->xp_pattern, 2) == 0) {
return cat_prefix_varname('g', name);
}
diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim
index 34126b49fa..9d5987ba30 100644
--- a/src/nvim/testdir/test_cmdline.vim
+++ b/src/nvim/testdir/test_cmdline.vim
@@ -602,6 +602,11 @@ func Test_cmdline_complete_user_func()
" g: prefix also works
call feedkeys(":echo g:Test_cmdline_complete_user_f\<Tab>\<Home>\"\<cr>", 'tx')
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
func Test_cmdline_complete_user_names()