]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.3.872 v7.3.872
authorBram Moolenaar <Bram@vim.org>
Tue, 19 Mar 2013 15:49:16 +0000 (16:49 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 19 Mar 2013 15:49:16 +0000 (16:49 +0100)
Problem:    On some systems case of file names is always ignored, on others
            never.
Solution:   Add the 'fileignorecase' option to control this at runtime.
            Implies 'wildignorecase'.

13 files changed:
runtime/doc/options.txt
runtime/plugin/matchparen.vim
src/buffer.c
src/edit.c
src/ex_cmds2.c
src/ex_getln.c
src/fileio.c
src/misc1.c
src/misc2.c
src/option.c
src/option.h
src/version.c
src/vim.h

index ac3d394a1619d42d12c0f5776371efe3f78cfd96..fbfad697fe7a20e5b0e24b062617471d6c0a0a75 100644 (file)
@@ -1,4 +1,4 @@
-*options.txt*  For Vim version 7.3.  Last change: 2013 Mar 13
+*options.txt*  For Vim version 7.3.  Last change: 2013 Mar 19
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -2941,6 +2941,14 @@ A jump table for the options with a short description can be found at |Q_op|.
        NOTE: This option is set to the Vi default value when 'compatible' is
        set and to the Vim default value when 'compatible' is reset.
 
+                       *'fileignorecase'* *'wic'* *'nofileignorecase'* *'nowic'*
+'fileignorecase' 'wic' boolean (default on for systems where case in file
+                                names is normally ignored.
+                       global
+                       {not in Vi}
+       When set case is ignored when using file names and directories.
+       See 'wildignorecase' for only ignoring case when doing completion.
+
                                        *'filetype'* *'ft'*
 'filetype' 'ft'                string (default: "")
                        local to buffer
@@ -7903,7 +7911,7 @@ A jump table for the options with a short description can be found at |Q_op|.
                        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.
+       Has no effect when 'fileignorecase' is set.
        Does not apply when the shell is used to expand wildcards, which
        happens when there are special characters.
 
index 32f0a8349188c129664b822afddcff59f25d1d33..c9cf903d5120db76e2b3651b50926bb924ad2b62 100644 (file)
@@ -1,6 +1,6 @@
 " Vim plugin for showing matching parens
 " Maintainer:  Bram Moolenaar <Bram@vim.org>
-" Last Change: 2011 Aug 27
+" Last Change: 2013 Mar 19
 
 " Exit quickly when:
 " - this plugin was already loaded (or disabled)
index 5c63899c83009b8937208f87fc83baa3b7603010..2a9fe4d12307453aad88ef96df2a0da076b53dba 100644 (file)
@@ -2401,12 +2401,7 @@ fname_match(prog, name)
     if (name != NULL)
     {
        regmatch.regprog = prog;
-#ifdef CASE_INSENSITIVE_FILENAME
-       regmatch.rm_ic = TRUE;          /* Always ignore case */
-#else
-       regmatch.rm_ic = FALSE;         /* Never ignore case */
-#endif
-
+       regmatch.rm_ic = p_fic; /* ignore case when 'fileignorecase' is set */
        if (vim_regexec(&regmatch, name, (colnr_T)0))
            match = name;
        else
index 5d609519ac508b447cfa66c07791fddeceed4c61..65038e4372b62320fe8e58881f008674dda158e5 100644 (file)
@@ -4336,13 +4336,7 @@ ins_compl_get_exp(ini)
 
                /* May change home directory back to "~". */
                tilde_replace(compl_pattern, num_matches, matches);
-               ins_compl_add_matches(num_matches, matches,
-#ifdef CASE_INSENSITIVE_FILENAME
-                       TRUE
-#else
-                       FALSE
-#endif
-                       );
+               ins_compl_add_matches(num_matches, matches, p_fic || p_wic);
            }
            break;
 
index de190e78c392c43193c25a6a7432f46629937d7c..11446efd414e29960191b6a127b660d5eff27bed 100644 (file)
@@ -1926,11 +1926,7 @@ do_arglist(str, what, after)
         * Delete the items: use each item as a regexp and find a match in the
         * argument list.
         */
-#ifdef CASE_INSENSITIVE_FILENAME
-       regmatch.rm_ic = TRUE;          /* Always ignore case */
-#else
-       regmatch.rm_ic = FALSE;         /* Never ignore case */
-#endif
+       regmatch.rm_ic = p_fic; /* ignore case when 'fileignorecase' is set */
        for (i = 0; i < new_ga.ga_len && !got_int; ++i)
        {
            p = ((char_u **)new_ga.ga_data)[i];
index 57582e84dfa38534bafd179bbc26d1bda7053984..d8a4a67f4d7477fe5321923d462d05375146530d 100644 (file)
@@ -3653,19 +3653,16 @@ ExpandOne(xp, str, orig, options, mode)
        {
            for (i = 0; i < xp->xp_numfiles; ++i)
            {
-#ifdef CASE_INSENSITIVE_FILENAME
-               if (xp->xp_context == EXPAND_DIRECTORIES
+               if (p_fic && (xp->xp_context == EXPAND_DIRECTORIES
                        || xp->xp_context == EXPAND_FILES
                        || xp->xp_context == EXPAND_SHELLCMD
-                       || xp->xp_context == EXPAND_BUFFERS)
+                       || xp->xp_context == EXPAND_BUFFERS))
                {
                    if (TOLOWER_LOC(xp->xp_files[i][len]) !=
                                            TOLOWER_LOC(xp->xp_files[0][len]))
                        break;
                }
-               else
-#endif
-                    if (xp->xp_files[i][len] != xp->xp_files[0][len])
+               else if (xp->xp_files[i][len] != xp->xp_files[0][len])
                    break;
            }
            if (i < xp->xp_numfiles)
index b5a49b87463af7df76725a59d3d40562c394ba46..6e89b888c3e91b0bf6657feddf16b5901e5c0f55 100644 (file)
@@ -6485,9 +6485,7 @@ vim_rename(from, to)
 #ifdef HAVE_ACL
     vim_acl_T  acl;            /* ACL from original file */
 #endif
-#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
     int                use_tmp_file = FALSE;
-#endif
 
     /*
      * When the names are identical, there is nothing to do.  When they refer
@@ -6496,11 +6494,9 @@ vim_rename(from, to)
      */
     if (fnamecmp(from, to) == 0)
     {
-#ifdef CASE_INSENSITIVE_FILENAME
-       if (STRCMP(gettail(from), gettail(to)) != 0)
+       if (p_fic && STRCMP(gettail(from), gettail(to)) != 0)
            use_tmp_file = TRUE;
        else
-#endif
            return 0;
     }
 
@@ -6539,7 +6535,6 @@ vim_rename(from, to)
     }
 #endif
 
-#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
     if (use_tmp_file)
     {
        char    tempname[MAXPATHL + 1];
@@ -6572,7 +6567,6 @@ vim_rename(from, to)
        }
        return -1;
     }
-#endif
 
     /*
      * Delete the "to" file, this is required on some systems to make the
@@ -10007,11 +10001,7 @@ match_file_pat(pattern, prog, fname, sfname, tail, allow_dirs)
     int                match = FALSE;
 #endif
 
-#ifdef CASE_INSENSITIVE_FILENAME
-    regmatch.rm_ic = TRUE;             /* Always ignore case */
-#else
-    regmatch.rm_ic = FALSE;            /* Don't ever ignore case */
-#endif
+    regmatch.rm_ic = p_fic; /* ignore case if 'fileignorecase' is set */
 #ifdef FEAT_OSFILETYPE
     if (*pattern == '<')
     {
index c1cc89cb692fcbdd6f7296eabf72681d32fd4af3..1cad0f53b15cceeb57d6c398d6aa3785df249685 100644 (file)
@@ -5026,16 +5026,21 @@ dir_of_file_exists(fname)
     return retval;
 }
 
-#if (defined(CASE_INSENSITIVE_FILENAME) && defined(BACKSLASH_IN_FILENAME)) \
-       || defined(PROTO)
 /*
- * Versions of fnamecmp() and fnamencmp() that handle '/' and '\' equally.
+ * Versions of fnamecmp() and fnamencmp() that handle '/' and '\' equally
+ * and deal with 'fileignorecase'.
  */
     int
 vim_fnamecmp(x, y)
     char_u     *x, *y;
 {
+#ifdef BACKSLASH_IN_FILENAME
     return vim_fnamencmp(x, y, MAXPATHL);
+#else
+    if (p_fic)
+       return MB_STRICMP(x, y);
+    return STRCMP(x, y);
+#endif
 }
 
     int
@@ -5043,9 +5048,11 @@ vim_fnamencmp(x, y, len)
     char_u     *x, *y;
     size_t     len;
 {
+#ifdef BACKSLASH_IN_FILENAME
+    /* TODO: multi-byte characters. */
     while (len > 0 && *x && *y)
     {
-       if (TOLOWER_LOC(*x) != TOLOWER_LOC(*y)
+       if ((p_fic ? TOLOWER_LOC(*x) != TOLOWER_LOC(*y) : *x != *y)
                && !(*x == '/' && *y == '\\')
                && !(*x == '\\' && *y == '/'))
            break;
@@ -5056,8 +5063,12 @@ vim_fnamencmp(x, y, len)
     if (len == 0)
        return 0;
     return (*x - *y);
-}
+#else
+    if (p_fic)
+       return MB_STRNICMP(x, y, len);
+    return STRNCMP(x, y, len);
 #endif
+}
 
 /*
  * Concatenate file names fname1 and fname2 into allocated memory.
@@ -9835,11 +9846,8 @@ unix_expandpath(gap, path, wildoff, flags, didstar)
        }
        else if (path_end >= path + wildoff
                         && (vim_strchr((char_u *)"*?[{~$", *path_end) != NULL
-#ifndef CASE_INSENSITIVE_FILENAME
-                            || ((flags & EW_ICASE)
-                                              && isalpha(PTR2CHAR(path_end)))
-#endif
-                            ))
+                            || (!p_fic && (flags & EW_ICASE)
+                                            && isalpha(PTR2CHAR(path_end)))))
            e = p;
 #ifdef FEAT_MBYTE
        if (has_mbyte)
@@ -9882,14 +9890,10 @@ unix_expandpath(gap, path, wildoff, flags, didstar)
     }
 
     /* compile the regexp into a program */
-#ifdef CASE_INSENSITIVE_FILENAME
-    regmatch.rm_ic = TRUE;             /* Behave like Terminal.app */
-#else
     if (flags & EW_ICASE)
        regmatch.rm_ic = TRUE;          /* 'wildignorecase' set */
     else
-       regmatch.rm_ic = FALSE;         /* Don't ignore case */
-#endif
+       regmatch.rm_ic = p_fic; /* ignore case when 'fileignorecase' is set */
     if (flags & (EW_NOERROR | EW_NOTWILD))
        ++emsg_silent;
     regmatch.regprog = vim_regcomp(pat, RE_MAGIC);
index 72a034362b27b28583fb8e5aa09a14b5b9793176..f075639b0d8dfa72a0d2a6ecc6fd7b603585eefc 100644 (file)
@@ -5362,13 +5362,11 @@ ff_wc_equal(s1, s2)
     if (STRLEN(s1) != STRLEN(s2))
        return FAIL;
 
+    /* TODO: handle multi-byte characters. */
     for (i = 0; s1[i] != NUL && s2[i] != NUL; i++)
     {
        if (s1[i] != s2[i]
-#ifdef CASE_INSENSITIVE_FILENAME
-               && TOUPPER_LOC(s1[i]) != TOUPPER_LOC(s2[i])
-#endif
-               )
+                     && (!p_fic || TOUPPER_LOC(s1[i]) != TOUPPER_LOC(s2[i])))
        {
            if (i >= 2)
                if (s1[i-1] == '*' && s1[i-2] == '*')
@@ -6123,12 +6121,7 @@ pathcmp(p, q, maxlen)
            break;
        }
 
-       if (
-#ifdef CASE_INSENSITIVE_FILENAME
-               TOUPPER_LOC(p[i]) != TOUPPER_LOC(q[i])
-#else
-               p[i] != q[i]
-#endif
+       if ((p_fic ? TOUPPER_LOC(p[i]) != TOUPPER_LOC(q[i]) : p[i] != q[i])
 #ifdef BACKSLASH_IN_FILENAME
                /* consider '/' and '\\' to be equal */
                && !((p[i] == '/' && q[i] == '\\')
index 467d578a6fa43e08c0c55f3ee8b5edde716e68b0..39b48dea80efbcb4977f2096e35bea76882edcac 100644 (file)
@@ -1108,6 +1108,15 @@ static struct vimoption
                            (char_u *)&p_ffs, PV_NONE,
                            {(char_u *)DFLT_FFS_VI, (char_u *)DFLT_FFS_VIM}
                            SCRIPTID_INIT},
+    {"fileignorecase", "fic", P_BOOL|P_VI_DEF,
+                           (char_u *)&p_fic, PV_NONE,
+                           {
+#ifdef CASE_INSENSITIVE_FILENAME
+                                   (char_u *)TRUE,
+#else
+                                   (char_u *)FALSE,
+#endif
+                                       (char_u *)0L} SCRIPTID_INIT},
     {"filetype",    "ft",   P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME,
 #ifdef FEAT_AUTOCMD
                            (char_u *)&p_ft, PV_FT,
index 3474d8e7b11c436603c2f4e13c90db156e578332..8b982f580e5f28494cc8c5bce32547422c8ba3f1 100644 (file)
@@ -453,6 +453,7 @@ EXTERN int  p_exrc;         /* 'exrc' */
 EXTERN char_u  *p_fencs;       /* 'fileencodings' */
 #endif
 EXTERN char_u  *p_ffs;         /* 'fileformats' */
+EXTERN long    p_fic;          /* 'fileignorecase' */
 #ifdef FEAT_FOLDING
 EXTERN char_u  *p_fcl;         /* 'foldclose' */
 EXTERN long    p_fdls;         /* 'foldlevelstart' */
index 1a652acdf9991344396620bcbb308b508630e06e..072005f97c7cd825c64af35846e263c5fe1cf658 100644 (file)
@@ -728,6 +728,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    872,
 /**/
     871,
 /**/
index fa2e075b3aa71cad29e8568d3fa3cef144488201..db2650ecd605095b207a7bf94bf70d6c6a2e62b6 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -1627,18 +1627,8 @@ void mch_memmove __ARGS((void *, void *, size_t));
  * (this does not account for maximum name lengths and things like "../dir",
  * thus it is not 100% accurate!)
  */
-#ifdef CASE_INSENSITIVE_FILENAME
-# ifdef BACKSLASH_IN_FILENAME
-#  define fnamecmp(x, y) vim_fnamecmp((x), (y))
-#  define fnamencmp(x, y, n) vim_fnamencmp((x), (y), (size_t)(n))
-# else
-#  define fnamecmp(x, y) MB_STRICMP((x), (y))
-#  define fnamencmp(x, y, n) MB_STRNICMP((x), (y), (n))
-# endif
-#else
-# define fnamecmp(x, y) strcmp((char *)(x), (char *)(y))
-# define fnamencmp(x, y, n) strncmp((char *)(x), (char *)(y), (size_t)(n))
-#endif
+#define fnamecmp(x, y) vim_fnamecmp((char_u *)(x), (char_u *)(y))
+#define fnamencmp(x, y, n) vim_fnamencmp((char_u *)(x), (char_u *)(y), (size_t)(n))
 
 #ifdef HAVE_MEMSET
 # define vim_memset(ptr, c, size)   memset((ptr), (c), (size))