Skip to content

Commit

Permalink
patch 8.0.1464: completing directory after :find does not add slash
Browse files Browse the repository at this point in the history
Problem:    Completing directory after :find does not add slash.
Solution:   Adjust the flags for globpath(). (Genki Sky)
  • Loading branch information
brammool committed Feb 3, 2018
1 parent ec48a9c commit 8a37b03
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/misc1.c
Expand Up @@ -10761,6 +10761,7 @@ expand_in_path(
char_u *curdir;
garray_T path_ga;
char_u *paths = NULL;
int glob_flags = 0;

if ((curdir = alloc((unsigned)MAXPATHL)) == NULL)
return 0;
Expand All @@ -10777,7 +10778,11 @@ expand_in_path(
if (paths == NULL)
return 0;

globpath(paths, pattern, gap, (flags & EW_ICASE) ? WILD_ICASE : 0);
if (flags & EW_ICASE)
glob_flags |= WILD_ICASE;
if (flags & EW_ADDSLASH)
glob_flags |= WILD_ADD_SLASH;
globpath(paths, pattern, gap, glob_flags);
vim_free(paths);

return gap->ga_len;
Expand Down
6 changes: 6 additions & 0 deletions src/testdir/test_find_complete.vim
Expand Up @@ -86,6 +86,12 @@ func Test_find_complete()
call feedkeys(":find f\t\n", "xt")
call assert_equal('Holy Grail', getline(1))

" Test that find completion on directory appends a slash
call feedkeys(":find in/pa\tfile.txt\n", "xt")
call assert_equal('E.T.', getline(1))
call feedkeys(":find ./i\tstuff.txt\n", "xt")
call assert_equal('Another Holy Grail', getline(1))

" Test shortening of
"
" foo/x/bar/voyager.txt
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -771,6 +771,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1464,
/**/
1463,
/**/
Expand Down

0 comments on commit 8a37b03

Please sign in to comment.