Skip to content

Commit 8a37b03

Browse files
committed
patch 8.0.1464: completing directory after :find does not add slash
Problem: Completing directory after :find does not add slash. Solution: Adjust the flags for globpath(). (Genki Sky)
1 parent ec48a9c commit 8a37b03

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/misc1.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10761,6 +10761,7 @@ expand_in_path(
1076110761
char_u *curdir;
1076210762
garray_T path_ga;
1076310763
char_u *paths = NULL;
10764+
int glob_flags = 0;
1076410765

1076510766
if ((curdir = alloc((unsigned)MAXPATHL)) == NULL)
1076610767
return 0;
@@ -10777,7 +10778,11 @@ expand_in_path(
1077710778
if (paths == NULL)
1077810779
return 0;
1077910780

10780-
globpath(paths, pattern, gap, (flags & EW_ICASE) ? WILD_ICASE : 0);
10781+
if (flags & EW_ICASE)
10782+
glob_flags |= WILD_ICASE;
10783+
if (flags & EW_ADDSLASH)
10784+
glob_flags |= WILD_ADD_SLASH;
10785+
globpath(paths, pattern, gap, glob_flags);
1078110786
vim_free(paths);
1078210787

1078310788
return gap->ga_len;

src/testdir/test_find_complete.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ func Test_find_complete()
8686
call feedkeys(":find f\t\n", "xt")
8787
call assert_equal('Holy Grail', getline(1))
8888

89+
" Test that find completion on directory appends a slash
90+
call feedkeys(":find in/pa\tfile.txt\n", "xt")
91+
call assert_equal('E.T.', getline(1))
92+
call feedkeys(":find ./i\tstuff.txt\n", "xt")
93+
call assert_equal('Another Holy Grail', getline(1))
94+
8995
" Test shortening of
9096
"
9197
" foo/x/bar/voyager.txt

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,8 @@ static char *(features[]) =
771771

772772
static int included_patches[] =
773773
{ /* Add new patch number below this line */
774+
/**/
775+
1464,
774776
/**/
775777
1463,
776778
/**/

0 commit comments

Comments
 (0)