Loading ...
Sorry, an error occurred while loading the content.

Patch 7.3.072

Expand Messages
  • Bram Moolenaar
    Patch 7.3.072 Problem: Can t complete file names while ignoring case. Solution: Add wildignorecase . Files: src/ex_docmd.c, src/ex_getln.c,
    Message 1 of 2 , Dec 2, 2010
    View Source
    • 0 Attachment
      Patch 7.3.072
      Problem: Can't complete file names while ignoring case.
      Solution: Add 'wildignorecase'.
      Files: src/ex_docmd.c, src/ex_getln.c, src/misc1.c, src/option.c,
      src/option.h, src/vim.h, runtime/doc/options.txt


      *** ../vim-7.3.071/src/ex_docmd.c 2010-11-24 15:50:54.000000000 +0100
      --- src/ex_docmd.c 2010-12-02 15:58:10.000000000 +0100
      ***************
      *** 4524,4535 ****
      else /* n == 2 */
      {
      expand_T xpc;

      ExpandInit(&xpc);
      xpc.xp_context = EXPAND_FILES;
      p = ExpandOne(&xpc, eap->arg, NULL,
      ! WILD_LIST_NOTFOUND|WILD_ADD_SLASH,
      ! WILD_EXPAND_FREE);
      if (p == NULL)
      return FAIL;
      }
      --- 4524,4537 ----
      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,
      ! options, WILD_EXPAND_FREE);
      if (p == NULL)
      return FAIL;
      }
      *** ../vim-7.3.071/src/ex_getln.c 2010-11-16 14:05:48.000000000 +0100
      --- src/ex_getln.c 2010-11-28 15:07:49.000000000 +0100
      ***************
      *** 3339,3348 ****
      p2 = NULL;
      else
      {
      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);
      vim_free(p1);
      /* longest match: make sure it is not shorter, happens with :help */
      if (p2 != NULL && type == WILD_LONGEST)
      --- 3339,3352 ----
      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),
      ! use_options, type);
      vim_free(p1);
      /* longest match: make sure it is not shorter, happens with :help */
      if (p2 != NULL && type == WILD_LONGEST)
      ***************
      *** 3428,3433 ****
      --- 3432,3438 ----
      * 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,4366 ****
      --- 4366,4372 ----
      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,4387 ****
      if (file_str == NULL)
      return EXPAND_UNSUCCESSFUL;

      /* find all files that match the description */
      ! if (ExpandFromContext(xp, file_str, matchcount, matches,
      ! WILD_ADD_SLASH|WILD_SILENT) == FAIL)
      {
      *matchcount = 0;
      *matches = NULL;
      --- 4385,4395 ----
      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, options) == FAIL)
      {
      *matchcount = 0;
      *matches = NULL;
      ***************
      *** 4433,4439 ****
      char_u *pat;
      int *num_file;
      char_u ***file;
      ! int options;
      {
      #ifdef FEAT_CMDL_COMPL
      regmatch_T regmatch;
      --- 4441,4447 ----
      char_u *pat;
      int *num_file;
      char_u ***file;
      ! int options; /* EW_ flags */
      {
      #ifdef FEAT_CMDL_COMPL
      regmatch_T regmatch;
      ***************
      *** 4487,4492 ****
      --- 4495,4503 ----
      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)
      *** ../vim-7.3.071/src/misc1.c 2010-08-16 21:46:12.000000000 +0200
      --- src/misc1.c 2010-11-28 15:02:57.000000000 +0100
      ***************
      *** 9161,9167 ****
      #ifdef CASE_INSENSITIVE_FILENAME
      regmatch.rm_ic = TRUE; /* Behave like Terminal.app */
      #else
      ! regmatch.rm_ic = FALSE; /* Don't ever ignore case */
      #endif
      regmatch.regprog = vim_regcomp(pat, RE_MAGIC);
      vim_free(pat);
      --- 9161,9170 ----
      #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.regprog = vim_regcomp(pat, RE_MAGIC);
      vim_free(pat);
      ***************
      *** 9643,9649 ****
      if (paths == NULL)
      return 0;

      ! files = globpath(paths, pattern, 0);
      vim_free(paths);
      if (files == NULL)
      return 0;
      --- 9646,9652 ----
      if (paths == NULL)
      return 0;

      ! files = globpath(paths, pattern, (flags & EW_ICASE) ? WILD_ICASE : 0);
      vim_free(paths);
      if (files == NULL)
      return 0;
      *** ../vim-7.3.071/src/option.c 2010-12-02 15:33:10.000000000 +0100
      --- src/option.c 2010-12-02 15:12:02.000000000 +0100
      ***************
      *** 2740,2746 ****
      (char_u *)&p_wc, PV_NONE,
      {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB}
      SCRIPTID_INIT},
      ! {"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,
      --- 2740,2746 ----
      (char_u *)&p_wc, PV_NONE,
      {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB}
      SCRIPTID_INIT},
      ! {"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,2755 ****
      --- 2750,2758 ----
      (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,
      *** ../vim-7.3.071/src/option.h 2010-08-15 21:57:28.000000000 +0200
      --- src/option.h 2010-11-28 14:29:18.000000000 +0100
      ***************
      *** 872,877 ****
      --- 872,878 ----
      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' */
      *** ../vim-7.3.071/src/vim.h 2010-10-20 19:17:43.000000000 +0200
      --- src/vim.h 2010-11-28 14:49:02.000000000 +0100
      ***************
      *** 798,803 ****
      --- 798,804 ----
      #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,813 ****
      --- 809,815 ----
      #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. */

      *** ../vim-7.3.071/runtime/doc/options.txt 2010-10-20 17:44:01.000000000 +0200
      --- runtime/doc/options.txt 2010-12-02 11:15:01.000000000 +0100
      ***************
      *** 7748,7753 ****
      --- 7756,7772 ----
      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
      *** ../vim-7.3.071/src/version.c 2010-12-02 15:33:10.000000000 +0100
      --- src/version.c 2010-12-02 15:57:14.000000000 +0100
      ***************
      *** 716,717 ****
      --- 716,719 ----
      { /* Add new patch number below this line */
      + /**/
      + 72,
      /**/

      --
      I recommend ordering large cargo containers of paper towels to make up
      whatever budget underruns you have. Paper products are always useful and they
      have the advantage of being completely flushable if you need to make room in
      the storage area later.
      (Scott Adams - The Dilbert principle)

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ an exciting new programming language -- http://www.Zimbu.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Peter Odding
      ... Thanks for this patch Bram. This is one of the few things I ve missed every day since I started using Vim some years ago. I just recompiled to try the
      Message 2 of 2 , Dec 2, 2010
      View Source
      • 0 Attachment
        > Patch 7.3.072
        > Problem: Can't complete file names while ignoring case.
        > Solution: Add 'wildignorecase'.

        Thanks for this patch Bram. This is one of the few things I've missed
        every day since I started using Vim some years ago. I just recompiled to
        try the patch and it works great!

        - Peter

        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      Your message has been successfully submitted and would be delivered to recipients shortly.