Patch 7.4.2112
Problem:    getcompletion(.., 'dir') returns a match with trailing "*" when
            there are no matches. (Chdiza)
Solution:   Return an empty list when there are no matches.  Add a trailing
            slash to directories. (Yegappan Lakshmanan)  Add tests for no
            matches. (closes #947)
Files:      src/evalfunc.c, src/testdir/test_cmdline.vim


*** ../vim-7.4.2111/src/evalfunc.c      2016-07-24 21:58:39.696057708 +0200
--- src/evalfunc.c      2016-07-28 22:39:54.940632865 +0200
***************
*** 4164,4171 ****
  {
      char_u    *pat;
      expand_T  xpc;
!     int               options = WILD_KEEP_ALL | WILD_SILENT | WILD_USE_NL
!                                         | WILD_LIST_NOTFOUND | WILD_NO_BEEP;
  
      if (p_wic)
        options |= WILD_ICASE;
--- 4164,4171 ----
  {
      char_u    *pat;
      expand_T  xpc;
!     int               options = WILD_SILENT | WILD_USE_NL | WILD_ADD_SLASH
!                                       | WILD_NO_BEEP;
  
      if (p_wic)
        options |= WILD_ICASE;
***************
*** 4194,4200 ****
      pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
      if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL))
      {
!       int i;
  
        ExpandOne(&xpc, pat, NULL, options, WILD_ALL_KEEP);
  
--- 4194,4200 ----
      pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
      if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL))
      {
!       int     i;
  
        ExpandOne(&xpc, pat, NULL, options, WILD_ALL_KEEP);
  
*** ../vim-7.4.2111/src/testdir/test_cmdline.vim        2016-07-23 
15:47:29.042684295 +0200
--- src/testdir/test_cmdline.vim        2016-07-28 22:49:43.523181542 +0200
***************
*** 47,99 ****
  
    let l = getcompletion('v:n', 'var')
    call assert_true(index(l, 'v:null') >= 0)
  
    let l = getcompletion('', 'augroup')
    call assert_true(index(l, 'END') >= 0)
  
    let l = getcompletion('', 'behave')
    call assert_true(index(l, 'mswin') >= 0)
  
    let l = getcompletion('', 'color')
    call assert_true(index(l, 'default') >= 0)
  
    let l = getcompletion('', 'command')
    call assert_true(index(l, 'sleep') >= 0)
  
    let l = getcompletion('', 'dir')
!   call assert_true(index(l, 'samples') >= 0)
  
    let l = getcompletion('exe', 'expression')
    call assert_true(index(l, 'executable(') >= 0)
  
    let l = getcompletion('tag', 'function')
    call assert_true(index(l, 'taglist(') >= 0)
  
    let Flambda = {-> 'hello'}
    let l = getcompletion('', 'function')
    let l = filter(l, {i, v -> v =~ 'lambda'})
!   call assert_equal(0, len(l))
  
    let l = getcompletion('run', 'file')
    call assert_true(index(l, 'runtest.vim') >= 0)
  
    let l = getcompletion('ha', 'filetype')
    call assert_true(index(l, 'hamster') >= 0)
  
    let l = getcompletion('z', 'syntax')
    call assert_true(index(l, 'zimbu') >= 0)
  
    let l = getcompletion('jikes', 'compiler')
    call assert_true(index(l, 'jikes') >= 0)
  
    let l = getcompletion('last', 'help')
    call assert_true(index(l, ':tablast') >= 0)
  
    let l = getcompletion('time', 'option')
    call assert_true(index(l, 'timeoutlen') >= 0)
  
    let l = getcompletion('er', 'highlight')
    call assert_true(index(l, 'ErrorMsg') >= 0)
  
    " For others test if the name is recognized.
    let names = ['buffer', 'environment', 'file_in_path',
--- 47,129 ----
  
    let l = getcompletion('v:n', 'var')
    call assert_true(index(l, 'v:null') >= 0)
+   let l = getcompletion('v:notexists', 'var')
+   call assert_equal([], l)
  
    let l = getcompletion('', 'augroup')
    call assert_true(index(l, 'END') >= 0)
+   let l = getcompletion('blahblah', 'augroup')
+   call assert_equal([], l)
  
    let l = getcompletion('', 'behave')
    call assert_true(index(l, 'mswin') >= 0)
+   let l = getcompletion('not', 'behave')
+   call assert_equal([], l)
  
    let l = getcompletion('', 'color')
    call assert_true(index(l, 'default') >= 0)
+   let l = getcompletion('dirty', 'color')
+   call assert_equal([], l)
  
    let l = getcompletion('', 'command')
    call assert_true(index(l, 'sleep') >= 0)
+   let l = getcompletion('awake', 'command')
+   call assert_equal([], l)
  
    let l = getcompletion('', 'dir')
!   call assert_true(index(l, 'samples/') >= 0)
!   let l = getcompletion('NoMatch', 'dir')
!   call assert_equal([], l)
  
    let l = getcompletion('exe', 'expression')
    call assert_true(index(l, 'executable(') >= 0)
+   let l = getcompletion('kill', 'expression')
+   call assert_equal([], l)
  
    let l = getcompletion('tag', 'function')
    call assert_true(index(l, 'taglist(') >= 0)
+   let l = getcompletion('paint', 'function')
+   call assert_equal([], l)
  
    let Flambda = {-> 'hello'}
    let l = getcompletion('', 'function')
    let l = filter(l, {i, v -> v =~ 'lambda'})
!   call assert_equal([], l)
  
    let l = getcompletion('run', 'file')
    call assert_true(index(l, 'runtest.vim') >= 0)
+   let l = getcompletion('walk', 'file')
+   call assert_equal([], l)
  
    let l = getcompletion('ha', 'filetype')
    call assert_true(index(l, 'hamster') >= 0)
+   let l = getcompletion('horse', 'filetype')
+   call assert_equal([], l)
  
    let l = getcompletion('z', 'syntax')
    call assert_true(index(l, 'zimbu') >= 0)
+   let l = getcompletion('emacs', 'syntax')
+   call assert_equal([], l)
  
    let l = getcompletion('jikes', 'compiler')
    call assert_true(index(l, 'jikes') >= 0)
+   let l = getcompletion('break', 'compiler')
+   call assert_equal([], l)
  
    let l = getcompletion('last', 'help')
    call assert_true(index(l, ':tablast') >= 0)
+   let l = getcompletion('giveup', 'help')
+   call assert_equal([], l)
  
    let l = getcompletion('time', 'option')
    call assert_true(index(l, 'timeoutlen') >= 0)
+   let l = getcompletion('space', 'option')
+   call assert_equal([], l)
  
    let l = getcompletion('er', 'highlight')
    call assert_true(index(l, 'ErrorMsg') >= 0)
+   let l = getcompletion('dark', 'highlight')
+   call assert_equal([], l)
  
    " For others test if the name is recognized.
    let names = ['buffer', 'environment', 'file_in_path',
*** ../vim-7.4.2111/src/version.c       2016-07-28 22:22:39.982236402 +0200
--- src/version.c       2016-07-28 22:44:20.378175280 +0200
***************
*** 760,761 ****
--- 760,763 ----
  {   /* Add new patch number below this line */
+ /**/
+     2112,
  /**/

-- 
It is illegal for anyone to give lighted cigars to dogs, cats, and other
domesticated animal kept as pets.
                [real standing law in Illinois, United States of America]

 /// Bram Moolenaar -- b...@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    ///

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui