vim-patch:8.1.1791: 'completeslash' also applies to globpath()

Problem:    'completeslash' also applies to globpath().
Solution:   Add the WILD_IGNORE_COMPLETESLASH flag. (test by Yasuhiro
            Matsumoto, closes vim/vim#4760)
This commit is contained in:
skippi
2020-10-25 18:48:41 -05:00
parent c203f89ace
commit f8fd3d44ac
3 changed files with 11 additions and 8 deletions

View File

@@ -4007,7 +4007,7 @@ static void f_glob(typval_T *argvars, typval_T *rettv, FunPtr fptr)
/// "globpath()" function /// "globpath()" function
static void f_globpath(typval_T *argvars, typval_T *rettv, FunPtr fptr) static void f_globpath(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{ {
int flags = 0; // Flags for globpath. int flags = WILD_IGNORE_COMPLETESLASH; // Flags for globpath.
bool error = false; bool error = false;
// Return a string, or a list if the optional third argument is non-zero. // Return a string, or a list if the optional third argument is non-zero.

View File

@@ -4990,7 +4990,7 @@ ExpandFromContext (
char_u *pat, char_u *pat,
int *num_file, int *num_file,
char_u ***file, char_u ***file,
int options /* EW_ flags */ int options // WILD_ flags
) )
{ {
regmatch_T regmatch; regmatch_T regmatch;
@@ -5053,7 +5053,7 @@ ExpandFromContext (
if (free_pat) if (free_pat)
xfree(pat); xfree(pat);
#ifdef BACKSLASH_IN_FILENAME #ifdef BACKSLASH_IN_FILENAME
if (p_csl[0] != NUL) { if (p_csl[0] != NUL && (options & WILD_IGNORE_COMPLETESLASH) == 0) {
for (int i = 0; i < *num_file; i++) { for (int i = 0; i < *num_file; i++) {
char_u *ptr = (*file)[i]; char_u *ptr = (*file)[i];
while (*ptr != NUL) { while (*ptr != NUL) {

View File

@@ -367,9 +367,7 @@ endfunc
" Test for insert path completion with completeslash option " Test for insert path completion with completeslash option
func Test_ins_completeslash() func Test_ins_completeslash()
if !has('win32') CheckMSWindows
return
endif
call mkdir('Xdir') call mkdir('Xdir')
@@ -408,7 +406,12 @@ func Test_ins_completeslash()
%bw! %bw!
call delete('Xdir', 'rf') call delete('Xdir', 'rf')
set noshellslash
set completeslash=slash
call assert_true(stridx(globpath(&rtp, 'syntax/*.vim', 1, 1)[0], '\') != -1)
let &shellslash = orig_shellslash let &shellslash = orig_shellslash
set completeslash=
endfunc endfunc
func Test_pum_with_folds_two_tabs() func Test_pum_with_folds_two_tabs()