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)
diff --git a/src/misc1.c b/src/misc1.c
index 2d635d6..726500a 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -10761,6 +10761,7 @@
char_u *curdir;
garray_T path_ga;
char_u *paths = NULL;
+ int glob_flags = 0;
if ((curdir = alloc((unsigned)MAXPATHL)) == NULL)
return 0;
@@ -10777,7 +10778,11 @@
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;
diff --git a/src/testdir/test_find_complete.vim b/src/testdir/test_find_complete.vim
index 4732109..a7bc135 100644
--- a/src/testdir/test_find_complete.vim
+++ b/src/testdir/test_find_complete.vim
@@ -86,6 +86,12 @@
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
diff --git a/src/version.c b/src/version.c
index af19279..811d521 100644
--- a/src/version.c
+++ b/src/version.c
@@ -772,6 +772,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1464,
+/**/
1463,
/**/
1462,