]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.072 v7.3.072
authorBram Moolenaar <Bram@vim.org>
Thu, 2 Dec 2010 15:01:29 +0000 (16:01 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 2 Dec 2010 15:01:29 +0000 (16:01 +0100)
Problem:    Can't complete file names while ignoring case.
Solution:   Add 'wildignorecase'.

runtime/doc/options.txt
src/ex_docmd.c
src/ex_getln.c
src/misc1.c
src/option.c
src/option.h
src/version.c
src/vim.h

index db3ea35d6d4c5521ae2968e6752683cc342547ae..425f98314d8430f2b00a16606a4275571f59d872 100644 (file)
@@ -7752,6 +7752,17 @@ A jump table for the options with a short description can be found at |Q_op|.
        a pattern from the list.  This avoids problems when a future version
        uses another default.
 
+
+                       *'wildignorecase* *'wic'* *'nowildignorecase* *'nowic'*
+'wildignorecase' 'wic' boolean (default off)
+                       global
+                       {not in Vi}
+       When set case is ignored when completing file names and directories.
+       Has no effect on systems where file name case is generally ignored.
+       Does not apply when the shell is used to expand wildcards, which
+       happens when there are special characters.
+
+
                                *'wildmenu'* *'wmnu'* *'nowildmenu'* *'nowmnu'*
 'wildmenu' 'wmnu'      boolean (default off)
                        global
index 0aac8f85cb30351cb3165c452e41e79ce4cb2e68..3265860f408d77d6679e5c7c6dd207262a9a5293 100644 (file)
@@ -4524,12 +4524,14 @@ expand_filename(eap, cmdlinep, errormsgp)
                else /* n == 2 */
                {
                    expand_T    xpc;
+                   int         options = WILD_LIST_NOTFOUND|WILD_ADD_SLASH;
 
                    ExpandInit(&xpc);
                    xpc.xp_context = EXPAND_FILES;
+                   if (p_wic)
+                       options += WILD_ICASE;
                    p = ExpandOne(&xpc, eap->arg, NULL,
-                                           WILD_LIST_NOTFOUND|WILD_ADD_SLASH,
-                                                  WILD_EXPAND_FREE);
+                                                  options, WILD_EXPAND_FREE);
                    if (p == NULL)
                        return FAIL;
                }
index dfc6dffcf1d59b480a676bf7131ae385185a1566..66d2ec44abbb0b8f548c8637b6005239c50c058b 100644 (file)
@@ -3339,10 +3339,14 @@ nextwild(xp, type, options)
            p2 = NULL;
        else
        {
+           int use_options = options |
+                   WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE;
+
+           if (p_wic)
+               use_options += WILD_ICASE;
            p2 = ExpandOne(xp, p1,
                         vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
-                   WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE
-                                                             |options, type);
+                                                          use_options, type);
            vim_free(p1);
            /* longest match: make sure it is not shorter, happens with :help */
            if (p2 != NULL && type == WILD_LONGEST)
@@ -3428,6 +3432,7 @@ nextwild(xp, type, options)
  * options = WILD_KEEP_ALL:        don't remove 'wildignore' entries
  * options = WILD_SILENT:          don't print warning messages
  * options = WILD_ESCAPE:          put backslash before special chars
+ * options = WILD_ICASE:           ignore case for files
  *
  * The variables xp->xp_context and xp->xp_backslash must have been set!
  */
@@ -4361,6 +4366,7 @@ expand_cmdline(xp, str, col, matchcount, matches)
     char_u     ***matches;     /* return: array of pointers to matches */
 {
     char_u     *file_str = NULL;
+    int                options = WILD_ADD_SLASH|WILD_SILENT;
 
     if (xp->xp_context == EXPAND_UNSUCCESSFUL)
     {
@@ -4379,9 +4385,11 @@ expand_cmdline(xp, str, col, matchcount, matches)
     if (file_str == NULL)
        return EXPAND_UNSUCCESSFUL;
 
+    if (p_wic)
+       options += WILD_ICASE;
+
     /* find all files that match the description */
-    if (ExpandFromContext(xp, file_str, matchcount, matches,
-                                         WILD_ADD_SLASH|WILD_SILENT) == FAIL)
+    if (ExpandFromContext(xp, file_str, matchcount, matches, options) == FAIL)
     {
        *matchcount = 0;
        *matches = NULL;
@@ -4433,7 +4441,7 @@ ExpandFromContext(xp, pat, num_file, file, options)
     char_u     *pat;
     int                *num_file;
     char_u     ***file;
-    int                options;
+    int                options;  /* EW_ flags */
 {
 #ifdef FEAT_CMDL_COMPL
     regmatch_T regmatch;
@@ -4487,6 +4495,9 @@ ExpandFromContext(xp, pat, num_file, file, options)
            flags |= (EW_FILE | EW_PATH);
        else
            flags = (flags | EW_DIR) & ~EW_FILE;
+       if (options & WILD_ICASE)
+           flags |= EW_ICASE;
+
        /* Expand wildcards, supporting %:h and the like. */
        ret = expand_wildcards_eval(&pat, num_file, file, flags);
        if (free_pat)
index 0859dc759500b930c0a4e81669efa3f4b0cc7481..b14f2ed1453184257b7c1c8608545546021a267b 100644 (file)
@@ -9161,7 +9161,10 @@ unix_expandpath(gap, path, wildoff, flags, didstar)
 #ifdef CASE_INSENSITIVE_FILENAME
     regmatch.rm_ic = TRUE;             /* Behave like Terminal.app */
 #else
-    regmatch.rm_ic = FALSE;            /* Don't ever ignore case */
+    if (flags & EW_ICASE)
+       regmatch.rm_ic = TRUE;          /* 'wildignorecase' set */
+    else
+       regmatch.rm_ic = FALSE;         /* Don't ignore case */
 #endif
     regmatch.regprog = vim_regcomp(pat, RE_MAGIC);
     vim_free(pat);
@@ -9643,7 +9646,7 @@ expand_in_path(gap, pattern, flags)
     if (paths == NULL)
        return 0;
 
-    files = globpath(paths, pattern, 0);
+    files = globpath(paths, pattern, (flags & EW_ICASE) ? WILD_ICASE : 0);
     vim_free(paths);
     if (files == NULL)
        return 0;
index c8572d00ac27ca85ef0612be319e0e545a82ec7b..419ef68ef490b76b3da43af4be72b97e8ab7ee8a 100644 (file)
@@ -2740,7 +2740,7 @@ static struct vimoption
                            (char_u *)&p_wc, PV_NONE,
                            {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB}
                            SCRIPTID_INIT},
-    {"wildcharm",   "wcm",   P_NUM|P_VI_DEF,
+    {"wildcharm",   "wcm",  P_NUM|P_VI_DEF,
                            (char_u *)&p_wcm, PV_NONE,
                            {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
     {"wildignore",  "wig",  P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
@@ -2750,6 +2750,9 @@ static struct vimoption
                            (char_u *)NULL, PV_NONE,
 #endif
                            {(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
+    {"wildignorecase", "wic", P_BOOL|P_VI_DEF,
+                           (char_u *)&p_wic, PV_NONE,
+                           {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
     {"wildmenu",    "wmnu", P_BOOL|P_VI_DEF,
 #ifdef FEAT_WILDMENU
                            (char_u *)&p_wmnu, PV_NONE,
index 0f697c2e4f3c412ad442af3a5eec6b7e83426c73..ce911b81b0f515b25e5092de6cee0f993a27c067 100644 (file)
@@ -872,6 +872,7 @@ EXTERN int  p_wiv;          /* 'weirdinvert' */
 EXTERN char_u  *p_ww;          /* 'whichwrap' */
 EXTERN long    p_wc;           /* 'wildchar' */
 EXTERN long    p_wcm;          /* 'wildcharm' */
+EXTERN long    p_wic;          /* 'wildignorecase' */
 EXTERN char_u  *p_wim;         /* 'wildmode' */
 #ifdef FEAT_WILDMENU
 EXTERN int     p_wmnu;         /* 'wildmenu' */
index 339b8eb4cac57edb94270ad1dfafd76652cedd64..85128805fd5490a00b1d14b5f69aa3f8a6b07869 100644 (file)
@@ -714,6 +714,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    72,
 /**/
     71,
 /**/
index 5b74203307a3d9e7c4632bde69951ffebe89ba91..c799cce9c452ebccbe89a09022e44fa6ac9d41d0 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -798,6 +798,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
 #define WILD_KEEP_ALL          32
 #define WILD_SILENT            64
 #define WILD_ESCAPE            128
+#define WILD_ICASE             256
 
 /* Flags for expand_wildcards() */
 #define EW_DIR         0x01    /* include directory names */
@@ -808,6 +809,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
 #define EW_SILENT      0x20    /* don't print "1 returned" from shell */
 #define EW_EXEC                0x40    /* executable files */
 #define EW_PATH                0x80    /* search in 'path' too */
+#define EW_ICASE       0x100   /* ignore case */
 /* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
  * is used when executing commands and EW_SILENT for interactive expanding. */