changeset 28291:1c97a31f8f22 v8.2.4671

patch 8.2.4671: 'wildignorecase' is sometimes not used for glob() Commit: https://github.com/vim/vim/commit/a3157a476bfa8c3077d510cc8400093c0d115df5 Author: LemonBoy <thatlemon@gmail.com> Date: Sun Apr 3 11:58:31 2022 +0100 patch 8.2.4671: 'wildignorecase' is sometimes not used for glob() Problem: 'wildignorecase' is sometimes not used for glob(). Solution: Also use 'wildignorecase' when there are no wildcards. (closes #10066, closes #8350)
author Bram Moolenaar <Bram@vim.org>
date Sun, 03 Apr 2022 13:00:03 +0200
parents f5ea61be543b
children 5143c731bd61
files src/filepath.c src/testdir/test_functions.vim src/version.c
diffstat 3 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -3945,13 +3945,13 @@ gen_expand_wildcards(
 	    }
 
 	    /*
-	     * 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 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 (mch_has_exp_wildcard(p))
+	    if (mch_has_exp_wildcard(p) || (flags & EW_ICASE))
 	    {
 #if defined(FEAT_SEARCHPATH)
 		if ((flags & EW_PATH)
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -2821,6 +2821,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')
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4671,
+/**/
     4670,
 /**/
     4669,