Patch 8.2.4608
Problem:    getcompletion() does not work properly when 'wildoptions
            contains "fuzzy".
Solution:   Do not use addstar(). (Yegappan Lakshmanan, closes #9992,
            closes #9986)
Files:      runtime/doc/builtin.txt, src/cmdexpand.c,
            src/testdir/test_cmdline.vim


*** ../vim-8.2.4607/runtime/doc/builtin.txt     2022-03-14 19:24:41.863926393 
+0000
--- runtime/doc/builtin.txt     2022-03-22 15:59:42.298882555 +0000
***************
*** 3263,3268 ****
--- 3273,3282 ----
                is applied to filter the results.  Otherwise all the matches
                are returned. The 'wildignorecase' option always applies.
  
+               If the 'wildoptions' option contains 'fuzzy', then fuzzy
+               matching is used to get the completion matches. Otherwise
+               regular expression matching is used.
+ 
                If {type} is "cmdline", then the |cmdline-completion| result is
                returned.  For example, to complete the possible values after
                a ":call" command: >
*** ../vim-8.2.4607/src/cmdexpand.c     2022-03-16 13:33:22.074467978 +0000
--- src/cmdexpand.c     2022-03-22 15:59:42.298882555 +0000
***************
*** 3707,3713 ****
  # endif
      }
  
!     pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
      if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL))
      {
        int     i;
--- 3707,3718 ----
  # endif
      }
  
!     if (cmdline_fuzzy_completion_supported(&xpc))
!        // when fuzzy matching, don't modify the search string
!        pat = vim_strsave(xpc.xp_pattern);
!     else
!        pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
! 
      if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL))
      {
        int     i;
*** ../vim-8.2.4607/src/testdir/test_cmdline.vim        2022-03-17 
13:03:05.967464752 +0000
--- src/testdir/test_cmdline.vim        2022-03-22 15:59:42.298882555 +0000
***************
*** 552,557 ****
--- 552,573 ----
    call assert_fails('call getcompletion("abc", [])', 'E475:')
  endfunc
  
+ " Test for getcompletion() with "fuzzy" in 'wildoptions'
+ func Test_getcompletion_wildoptions()
+   let save_wildoptions = &wildoptions
+   set wildoptions&
+   let l = getcompletion('space', 'option')
+   call assert_equal([], l)
+   let l = getcompletion('ier', 'command')
+   call assert_equal([], l)
+   set wildoptions=fuzzy
+   let l = getcompletion('space', 'option')
+   call assert_true(index(l, 'backspace') >= 0)
+   let l = getcompletion('ier', 'command')
+   call assert_true(index(l, 'compiler') >= 0)
+   let &wildoptions = save_wildoptions
+ endfunc
+ 
  func Test_complete_autoload_error()
    let save_rtp = &rtp
    let lines =<< trim END
*** ../vim-8.2.4607/src/version.c       2022-03-22 12:13:49.151376708 +0000
--- src/version.c       2022-03-22 16:05:11.362284708 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4608,
  /**/

-- 
Apologies for taking up the bandwidth with the apology.  Anything else I
can apologise for ...... er no can't think of anything, sorry about that.
                Andy Hunt (Member of British Olympic Apology Squad)

 /// 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/20220322160753.03BF81C22C9%40moolenaar.net.

Raspunde prin e-mail lui