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\<Tab>\<Home>\"\<cr>", 'tx')
    call assert_match('"func <SNR>\d\+_ScriptLocalFunction', @:)
+ 
+   " 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', @:)
  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 -- [email protected] -- 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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202101131849.10DIntXM1338307%40masaka.moolenaar.net.

Raspunde prin e-mail lui