To: vim_dev@googlegroups.com Subject: Patch 8.2.2341 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2341 Problem: Expression command line completion shows variables but not functions after "g:". (Gary Johnson) Solution: Prefix "g:" when needed to a global function. Files: src/evalfunc.c, src/evalvars.c, src/proto/evalvars.pro, src/testdir/test_cmdline.vim *** ../vim-8.2.2340/src/evalfunc.c 2021-01-12 21:48:55.879131998 +0100 --- src/evalfunc.c 2021-01-13 19:48:14.780388620 +0100 *************** *** 1822,1828 **** --- 1822,1832 ---- { name = get_user_func_name(xp, idx); if (name != NULL) + { + if (*name != '<' && STRNCMP("g:", xp->xp_pattern, 2) == 0) + return cat_prefix_varname('g', name); return name; + } } if (++intidx < (int)(sizeof(global_functions) / sizeof(funcentry_T))) { *** ../vim-8.2.2340/src/evalvars.c 2021-01-11 21:20:05.669652000 +0100 --- src/evalvars.c 2021-01-13 19:41:38.821494733 +0100 *************** *** 1952,1958 **** /* * Function to concatenate a prefix and a variable name. */ ! static char_u * cat_prefix_varname(int prefix, char_u *name) { int len; --- 1952,1958 ---- /* * Function to concatenate a prefix and a variable name. */ ! char_u * cat_prefix_varname(int prefix, char_u *name) { int len; *** ../vim-8.2.2340/src/proto/evalvars.pro 2020-12-22 20:35:37.469034276 +0100 --- src/proto/evalvars.pro 2021-01-13 19:42:19.089384095 +0100 *************** *** 26,31 **** --- 26,32 ---- int do_unlet(char_u *name, int forceit); void item_lock(typval_T *tv, int deep, int lock, int check_refcount); void del_menutrans_vars(void); + char_u *cat_prefix_varname(int prefix, char_u *name); char_u *get_user_var_name(expand_T *xp, int idx); char *get_var_special_name(int nr); dict_T *get_globvar_dict(void); *** ../vim-8.2.2340/src/testdir/test_cmdline.vim 2020-12-28 13:41:49.642920468 +0100 --- src/testdir/test_cmdline.vim 2021-01-13 19:47:14.268559831 +0100 *************** *** 619,624 **** --- 619,628 ---- call assert_match('"func Test_cmdline_complete_user', @:) call feedkeys(":func s:ScriptL\\\"\", 'tx') call assert_match('"func \d\+_ScriptLocalFunction', @:) + + " g: prefix also works + call feedkeys(":echo g:Test_cmdline_complete_user_f\\\"\", 'tx') + call assert_match('"echo g:Test_cmdline_complete_user_func', @:) endfunc func Test_cmdline_complete_user_names() *** ../vim-8.2.2340/src/version.c 2021-01-12 22:08:50.087871728 +0100 --- src/version.c 2021-01-13 19:42:14.349397138 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2341, /**/ -- hundred-and-one symptoms of being an internet addict: 136. You decide to stay in a low-paying job teaching just for the free Internet access. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///