Patch 8.2.4366
Problem:    Not enough tests for command line completion.
Solution:   Add a few more tests. (Yegappan Lakshmanan, closes #9760)
Files:      src/cmdexpand.c, src/testdir/test_cmdline.vim,
            src/testdir/test_usercommands.vim


*** ../vim-8.2.4365/src/cmdexpand.c     2022-02-12 12:03:03.959691691 +0000
--- src/cmdexpand.c     2022-02-13 11:41:06.582680942 +0000
***************
*** 50,55 ****
--- 50,58 ----
      return STRCMP(p1, p2);
  }
  
+ /*
+  * Escape special characters in the cmdline completion matches.
+  */
      static void
  ExpandEscape(
      expand_T  *xp,
*** ../vim-8.2.4365/src/testdir/test_cmdline.vim        2022-02-11 
18:51:27.813814058 +0000
--- src/testdir/test_cmdline.vim        2022-02-13 11:41:06.582680942 +0000
***************
*** 409,414 ****
--- 409,420 ----
      call assert_equal(cmds, l)
      let l = getcompletion('list ', 'sign')
      call assert_equal(['Testing'], l)
+     let l = getcompletion('de*', 'sign')
+     call assert_equal(['define'], l)
+     let l = getcompletion('p?', 'sign')
+     call assert_equal(['place'], l)
+     let l = getcompletion('j.', 'sign')
+     call assert_equal(['jump'], l)
    endif
  
    " Command line completion tests
***************
*** 461,466 ****
--- 467,484 ----
    call delete('Xtags')
    set tags&
  
+   edit a~b
+   enew
+   call assert_equal(['a~b'], getcompletion('a~', 'buffer'))
+   bw a~b
+ 
+   if has('unix')
+     edit Xtest\
+     enew
+     call assert_equal(['Xtest\'], getcompletion('Xtest\', 'buffer'))
+     bw Xtest\
+   endif
+ 
    call assert_fails("call getcompletion('\\\\@!\\\\@=', 'buffer')", 'E871:')
    call assert_fails('call getcompletion("", "burp")', 'E475:')
    call assert_fails('call getcompletion("abc", [])', 'E475:')
***************
*** 1006,1011 ****
--- 1024,1048 ----
    call feedkeys(":chist\<Esc>\<Esc>", 'xt')
    call assert_equal('"g/a\xb/clearjumps', @:)
    set wildchar&
+ 
+   " should be able to complete a file name that starts with a '~'.
+   if has('unix')
+     call writefile([], '~Xtest')
+     call feedkeys(":e \\~X\<Tab>\<C-B>\"\<CR>", 'xt')
+     call assert_equal('"e \~Xtest', @:)
+     call delete('~Xtest')
+   endif
+ endfunc
+ 
+ " Test for 'wildignorecase'
+ func Test_cmdline_wildignorecase()
+   CheckUnix
+   call writefile([], 'XTEST')
+   set wildignorecase
+   call feedkeys(":e xt\<Tab>\<C-B>\"\<CR>", 'xt')
+   call assert_equal('"e XTEST', @:)
+   set wildignorecase&
+   call delete('XTEST')
  endfunc
  
  func Test_cmdline_write_alternatefile()
***************
*** 1627,1632 ****
--- 1664,1677 ----
    call assert_equal('AAA    AAAA   AAAAA', g:Sline)
    call assert_equal('"b A', @:)
  
+   " when using longest completion match, matches shorter than the argument
+   " should be ignored (happens with :help)
+   set wildmode=longest,full
+   set wildmenu
+   call feedkeys(":help a*\t\<C-B>\"\<CR>", 'xt')
+   call assert_equal('"help a', @:)
+   set wildmenu&
+ 
    %argdelete
    delcommand MyCmd
    delfunc T
*** ../vim-8.2.4365/src/testdir/test_usercommands.vim   2022-01-29 
21:45:30.485921485 +0000
--- src/testdir/test_usercommands.vim   2022-02-13 11:41:06.582680942 +0000
***************
*** 384,389 ****
--- 384,400 ----
    com! -nargs=? -complete=custom,min DoCmd
    call assert_fails("call feedkeys(':DoCmd \t', 'tx')", 'E118:')
  
+   " custom completion for a pattern with a backslash
+   let g:ArgLead = ''
+   func! CustCompl(A, L, P)
+     let g:ArgLead = a:A
+     return ['one', 'two', 'three']
+   endfunc
+   com! -nargs=? -complete=customlist,CustCompl DoCmd
+   call feedkeys(":DoCmd a\\\t", 'xt')
+   call assert_equal('a\', g:ArgLead)
+   delfunc CustCompl
+ 
    delcom DoCmd
  endfunc
  
*** ../vim-8.2.4365/src/version.c       2022-02-12 22:13:02.259074450 +0000
--- src/version.c       2022-02-13 11:42:35.122933319 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4366,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
38. You wake up at 3 a.m. to go to the bathroom and stop and check your e-mail
    on the way back to bed.

 /// 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/20220213114615.7738F1C0DFF%40moolenaar.net.

Raspunde prin e-mail lui