aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/path.c12
-rw-r--r--src/nvim/testdir/test_functions.vim2
2 files changed, 8 insertions, 6 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c
index 38112be3ce..ac07fbee87 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -1272,12 +1272,12 @@ int gen_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, i
}
}
- // If there are wildcards: Expand file names and add each match to
- // the list. If there is no match, and EW_NOTFOUND is given, add
- // the pattern.
- // If there are no wildcards: Add the file name if it exists or
- // when EW_NOTFOUND is given.
- if (path_has_exp_wildcard(p)) {
+ // If there are wildcards or case-insensitive expansion is
+ // required: Expand file names and add each match to the list. If
+ // there is no match, and EW_NOTFOUND is given, add the pattern.
+ // Otherwise: Add the file name if it exists or when EW_NOTFOUND is
+ // given.
+ if (path_has_exp_wildcard(p) || (flags & EW_ICASE)) {
if ((flags & EW_PATH)
&& !path_is_absolute(p)
&& !(p[0] == '.'
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index 99ac6ae32c..c41884936e 100644
--- a/src/nvim/testdir/test_functions.vim
+++ b/src/nvim/testdir/test_functions.vim
@@ -2026,6 +2026,8 @@ func Test_glob()
" Sort output of glob() otherwise we end up with different
" ordering depending on whether file system is case-sensitive.
call assert_equal(['XGLOB2', 'Xglob1'], sort(glob('Xglob[12]', 0, 1)))
+ " wildignorecase shall be applied even when the pattern contains no wildcards.
+ call assert_equal('XGLOB2', glob('xglob2'))
set wildignorecase&
call delete('Xglob1')