Patch 8.2.4475
Problem:    Fuzzy cmdline completion does not work for lower case.
Solution:   Also use fuzzy completion for lower case input. (Yegappan
            Lakshmanan, closes #9849)
Files:      src/cmdexpand.c, src/testdir/test_cmdline.vim


*** ../vim-8.2.4474/src/cmdexpand.c     2022-02-25 15:24:21.049157319 +0000
--- src/cmdexpand.c     2022-02-26 11:01:13.723136388 +0000
***************
*** 1212,1217 ****
--- 1212,1218 ----
  {
      char_u    *p = NULL;
      int               len = 0;
+     int               fuzzy = cmdline_fuzzy_complete(cmd);
  
      // Isolate the command and search for it in the command table.
      // Exceptions:
***************
*** 1253,1259 ****
  
        eap->cmdidx = excmd_get_cmdidx(cmd, len);
  
!       if (cmd[0] >= 'A' && cmd[0] <= 'Z')
            while (ASCII_ISALNUM(*p) || *p == '*')      // Allow * wild card
                ++p;
      }
--- 1254,1262 ----
  
        eap->cmdidx = excmd_get_cmdidx(cmd, len);
  
!       // User defined commands support alphanumeric characters.
!       // Also when doing fuzzy expansion, support alphanumeric characters.
!       if ((cmd[0] >= 'A' && cmd[0] <= 'Z') || (fuzzy && *p != NUL))
            while (ASCII_ISALNUM(*p) || *p == '*')      // Allow * wild card
                ++p;
      }
***************
*** 2493,2498 ****
--- 2496,2502 ----
      int               ret;
      int               flags;
      char_u    *tofree = NULL;
+     int               fuzzy = cmdline_fuzzy_complete(pat);
  
      flags = map_wildopts_to_ewflags(options);
  
***************
*** 2577,2588 ****
        pat = tofree;
      }
  
!     regmatch.regprog = vim_regcomp(pat, magic_isset() ? RE_MAGIC : 0);
!     if (regmatch.regprog == NULL)
!       return FAIL;
  
!     // set ignore-case according to p_ic, p_scs and pat
!     regmatch.rm_ic = ignorecase(pat);
  
      if (xp->xp_context == EXPAND_SETTINGS
            || xp->xp_context == EXPAND_BOOL_SETTINGS)
--- 2581,2595 ----
        pat = tofree;
      }
  
!     if (!fuzzy)
!     {
!       regmatch.regprog = vim_regcomp(pat, magic_isset() ? RE_MAGIC : 0);
!       if (regmatch.regprog == NULL)
!           return FAIL;
  
!       // set ignore-case according to p_ic, p_scs and pat
!       regmatch.rm_ic = ignorecase(pat);
!     }
  
      if (xp->xp_context == EXPAND_SETTINGS
            || xp->xp_context == EXPAND_BOOL_SETTINGS)
***************
*** 2596,2602 ****
      else
        ret = ExpandOther(pat, xp, &regmatch, matches, numMatches);
  
!     vim_regfree(regmatch.regprog);
      vim_free(tofree);
  
      return ret;
--- 2603,2610 ----
      else
        ret = ExpandOther(pat, xp, &regmatch, matches, numMatches);
  
!     if (!fuzzy)
!       vim_regfree(regmatch.regprog);
      vim_free(tofree);
  
      return ret;
*** ../vim-8.2.4474/src/testdir/test_cmdline.vim        2022-02-25 
15:24:21.049157319 +0000
--- src/testdir/test_cmdline.vim        2022-02-26 11:01:40.031044879 +0000
***************
*** 2776,2781 ****
--- 2776,2793 ----
    delcommand T123FendingOff
    %bw
  
+   " Test for fuzzy completion of a command with lower case letters and a
+   " number
+   command Foo2Bar :
+   set wildoptions=fuzzy
+   call feedkeys(":foo2\<Tab>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"Foo2Bar', @:)
+   call feedkeys(":foo\<Tab>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"Foo2Bar', @:)
+   call feedkeys(":bar\<Tab>\<C-B>\"\<CR>", 'tx')
+   call assert_equal('"Foo2Bar', @:)
+   delcommand Foo2Bar
+ 
    set wildoptions&
    %bw!
  endfunc
*** ../vim-8.2.4474/src/version.c       2022-02-26 10:31:24.699882028 +0000
--- src/version.c       2022-02-26 11:03:46.990620161 +0000
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     4475,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
108. While reading a magazine, you look for the Zoom icon for a better
     look at a photograph.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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/20220226110601.F00331C05BB%40moolenaar.net.

Raspunde prin e-mail lui