Yegappan wrote:

> On Mon, Jul 25, 2016 at 11:28 AM, Yegappan Lakshmanan
> <yegapp...@gmail.com> wrote:
> > Hi,
> >
> > On Mon, Jul 25, 2016 at 10:42 AM, chdiza <vim-dev-git...@256bit.org> wrote:
> >>
> >> The new getcompletion() function is of limited usefulness if one wants to
> >> use it for any "type" that might return directory names. That's because it
> >> doesn't append the trailing slash to dir names. That means that
> >> getcompletion()'s results don't actually match what you would get at the
> >> command line by pressing .
> >>
> >> For example: from the command line, :cd myd<TAB> yields :cd mydir/. Yet
> >> echo getcompletion('myd', 'dir') yields mydir.
> >>
> >> This could be worked around by calling map() on the result of
> >> getcompletion() to append the slashes. But that only works for the type
> >> "dir". For "file", one can't just append slashes because some of
> >> getcompletion()'s matches will be file names, not dir names.
> >>
> >> Example: Suppose in the cwd I have a dir names "mydir" and a file named
> >> "myfile".
> >>
> >> At the command line, :e my<TAB> will show mydir/ and then myfile if you
> >> hit again. But :echo getcompletion("my", "file") will show a list 
> >> containing
> >> mydir and myfile. A blanket use of map() to append trailing slashes would
> >> result in myfile/ which is wrong.
> >>
> >> In short, getcompletion() should return a list that shows what would
> >> actually be presented at the command line. If that list contains dirnames,
> >> they should end in a slash. Otherwise, it isn't very useful in helping to
> >> define custom completion for files and dirs.
> >>
> > This is easy to fix (need to add WILD_ADD_SLASH to options in
> > f_getcompletion()).
> > I will send out a patch later.
> 
> A patch to fix this problem is attached. I have updated the test case
> to test for backslash or forward slash depending on the system
> (Unix/Windows). I have tested this on a Mac system. I haven't tested
> this on MS-Windows to make sure the test passes.

The tests are run with 'shellslash' set, thus I suspect the text fails.

-- 
To the optimist, the glass is half full.
To the pessimist, the glass is half empty.
To the engineer, the glass is twice as big as it needs to be.

 /// 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