Karsten Hopp 716f5c
To: vim_dev@googlegroups.com
Karsten Hopp 716f5c
Subject: Patch 7.3.072
Karsten Hopp 716f5c
Fcc: outbox
Karsten Hopp 716f5c
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 716f5c
Mime-Version: 1.0
Karsten Hopp 716f5c
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 716f5c
Content-Transfer-Encoding: 8bit
Karsten Hopp 716f5c
------------
Karsten Hopp 716f5c
Karsten Hopp 716f5c
Patch 7.3.072
Karsten Hopp 716f5c
Problem:    Can't complete file names while ignoring case.
Karsten Hopp 716f5c
Solution:   Add 'wildignorecase'.
Karsten Hopp 716f5c
Files:	    src/ex_docmd.c, src/ex_getln.c, src/misc1.c, src/option.c,
Karsten Hopp 716f5c
	    src/option.h, src/vim.h, runtime/doc/options.txt
Karsten Hopp 716f5c
Karsten Hopp 716f5c
Karsten Hopp 716f5c
*** ../vim-7.3.071/src/ex_docmd.c	2010-11-24 15:50:54.000000000 +0100
Karsten Hopp 716f5c
--- src/ex_docmd.c	2010-12-02 15:58:10.000000000 +0100
Karsten Hopp 716f5c
***************
Karsten Hopp 716f5c
*** 4524,4535 ****
Karsten Hopp 716f5c
  		else /* n == 2 */
Karsten Hopp 716f5c
  		{
Karsten Hopp 716f5c
  		    expand_T	xpc;
Karsten Hopp 716f5c
  
Karsten Hopp 716f5c
  		    ExpandInit(&xpc);
Karsten Hopp 716f5c
  		    xpc.xp_context = EXPAND_FILES;
Karsten Hopp 716f5c
  		    p = ExpandOne(&xpc, eap->arg, NULL,
Karsten Hopp 716f5c
! 					    WILD_LIST_NOTFOUND|WILD_ADD_SLASH,
Karsten Hopp 716f5c
! 						   WILD_EXPAND_FREE);
Karsten Hopp 716f5c
  		    if (p == NULL)
Karsten Hopp 716f5c
  			return FAIL;
Karsten Hopp 716f5c
  		}
Karsten Hopp 716f5c
--- 4524,4537 ----
Karsten Hopp 716f5c
  		else /* n == 2 */
Karsten Hopp 716f5c
  		{
Karsten Hopp 716f5c
  		    expand_T	xpc;
Karsten Hopp 716f5c
+ 		    int		options = WILD_LIST_NOTFOUND|WILD_ADD_SLASH;
Karsten Hopp 716f5c
  
Karsten Hopp 716f5c
  		    ExpandInit(&xpc);
Karsten Hopp 716f5c
  		    xpc.xp_context = EXPAND_FILES;
Karsten Hopp 716f5c
+ 		    if (p_wic)
Karsten Hopp 716f5c
+ 			options += WILD_ICASE;
Karsten Hopp 716f5c
  		    p = ExpandOne(&xpc, eap->arg, NULL,
Karsten Hopp 716f5c
! 						   options, WILD_EXPAND_FREE);
Karsten Hopp 716f5c
  		    if (p == NULL)
Karsten Hopp 716f5c
  			return FAIL;
Karsten Hopp 716f5c
  		}
Karsten Hopp 716f5c
*** ../vim-7.3.071/src/ex_getln.c	2010-11-16 14:05:48.000000000 +0100
Karsten Hopp 716f5c
--- src/ex_getln.c	2010-11-28 15:07:49.000000000 +0100
Karsten Hopp 716f5c
***************
Karsten Hopp 716f5c
*** 3339,3348 ****
Karsten Hopp 716f5c
  	    p2 = NULL;
Karsten Hopp 716f5c
  	else
Karsten Hopp 716f5c
  	{
Karsten Hopp 716f5c
  	    p2 = ExpandOne(xp, p1,
Karsten Hopp 716f5c
  			 vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
Karsten Hopp 716f5c
! 		    WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE
Karsten Hopp 716f5c
! 							      |options, type);
Karsten Hopp 716f5c
  	    vim_free(p1);
Karsten Hopp 716f5c
  	    /* longest match: make sure it is not shorter, happens with :help */
Karsten Hopp 716f5c
  	    if (p2 != NULL && type == WILD_LONGEST)
Karsten Hopp 716f5c
--- 3339,3352 ----
Karsten Hopp 716f5c
  	    p2 = NULL;
Karsten Hopp 716f5c
  	else
Karsten Hopp 716f5c
  	{
Karsten Hopp 716f5c
+ 	    int use_options = options |
Karsten Hopp 716f5c
+ 		    WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE;
Karsten Hopp 716f5c
+ 
Karsten Hopp 716f5c
+ 	    if (p_wic)
Karsten Hopp 716f5c
+ 		use_options += WILD_ICASE;
Karsten Hopp 716f5c
  	    p2 = ExpandOne(xp, p1,
Karsten Hopp 716f5c
  			 vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
Karsten Hopp 716f5c
! 							   use_options, type);
Karsten Hopp 716f5c
  	    vim_free(p1);
Karsten Hopp 716f5c
  	    /* longest match: make sure it is not shorter, happens with :help */
Karsten Hopp 716f5c
  	    if (p2 != NULL && type == WILD_LONGEST)
Karsten Hopp 716f5c
***************
Karsten Hopp 716f5c
*** 3428,3433 ****
Karsten Hopp 716f5c
--- 3432,3438 ----
Karsten Hopp 716f5c
   * options = WILD_KEEP_ALL:	    don't remove 'wildignore' entries
Karsten Hopp 716f5c
   * options = WILD_SILENT:	    don't print warning messages
Karsten Hopp 716f5c
   * options = WILD_ESCAPE:	    put backslash before special chars
Karsten Hopp 716f5c
+  * options = WILD_ICASE:	    ignore case for files
Karsten Hopp 716f5c
   *
Karsten Hopp 716f5c
   * The variables xp->xp_context and xp->xp_backslash must have been set!
Karsten Hopp 716f5c
   */
Karsten Hopp 716f5c
***************
Karsten Hopp 716f5c
*** 4361,4366 ****
Karsten Hopp 716f5c
--- 4366,4372 ----
Karsten Hopp 716f5c
      char_u	***matches;	/* return: array of pointers to matches */
Karsten Hopp 716f5c
  {
Karsten Hopp 716f5c
      char_u	*file_str = NULL;
Karsten Hopp 716f5c
+     int		options = WILD_ADD_SLASH|WILD_SILENT;
Karsten Hopp 716f5c
  
Karsten Hopp 716f5c
      if (xp->xp_context == EXPAND_UNSUCCESSFUL)
Karsten Hopp 716f5c
      {
Karsten Hopp 716f5c
***************
Karsten Hopp 716f5c
*** 4379,4387 ****
Karsten Hopp 716f5c
      if (file_str == NULL)
Karsten Hopp 716f5c
  	return EXPAND_UNSUCCESSFUL;
Karsten Hopp 716f5c
  
Karsten Hopp 716f5c
      /* find all files that match the description */
Karsten Hopp 716f5c
!     if (ExpandFromContext(xp, file_str, matchcount, matches,
Karsten Hopp 716f5c
! 					  WILD_ADD_SLASH|WILD_SILENT) == FAIL)
Karsten Hopp 716f5c
      {
Karsten Hopp 716f5c
  	*matchcount = 0;
Karsten Hopp 716f5c
  	*matches = NULL;
Karsten Hopp 716f5c
--- 4385,4395 ----
Karsten Hopp 716f5c
      if (file_str == NULL)
Karsten Hopp 716f5c
  	return EXPAND_UNSUCCESSFUL;
Karsten Hopp 716f5c
  
Karsten Hopp 716f5c
+     if (p_wic)
Karsten Hopp 716f5c
+ 	options += WILD_ICASE;
Karsten Hopp 716f5c
+ 
Karsten Hopp 716f5c
      /* find all files that match the description */
Karsten Hopp 716f5c
!     if (ExpandFromContext(xp, file_str, matchcount, matches, options) == FAIL)
Karsten Hopp 716f5c
      {
Karsten Hopp 716f5c
  	*matchcount = 0;
Karsten Hopp 716f5c
  	*matches = NULL;
Karsten Hopp 716f5c
***************
Karsten Hopp 716f5c
*** 4433,4439 ****
Karsten Hopp 716f5c
      char_u	*pat;
Karsten Hopp 716f5c
      int		*num_file;
Karsten Hopp 716f5c
      char_u	***file;
Karsten Hopp 716f5c
!     int		options;
Karsten Hopp 716f5c
  {
Karsten Hopp 716f5c
  #ifdef FEAT_CMDL_COMPL
Karsten Hopp 716f5c
      regmatch_T	regmatch;
Karsten Hopp 716f5c
--- 4441,4447 ----
Karsten Hopp 716f5c
      char_u	*pat;
Karsten Hopp 716f5c
      int		*num_file;
Karsten Hopp 716f5c
      char_u	***file;
Karsten Hopp 716f5c
!     int		options;  /* EW_ flags */
Karsten Hopp 716f5c
  {
Karsten Hopp 716f5c
  #ifdef FEAT_CMDL_COMPL
Karsten Hopp 716f5c
      regmatch_T	regmatch;
Karsten Hopp 716f5c
***************
Karsten Hopp 716f5c
*** 4487,4492 ****
Karsten Hopp 716f5c
--- 4495,4503 ----
Karsten Hopp 716f5c
  	    flags |= (EW_FILE | EW_PATH);
Karsten Hopp 716f5c
  	else
Karsten Hopp 716f5c
  	    flags = (flags | EW_DIR) & ~EW_FILE;
Karsten Hopp 716f5c
+ 	if (options & WILD_ICASE)
Karsten Hopp 716f5c
+ 	    flags |= EW_ICASE;
Karsten Hopp 716f5c
+ 
Karsten Hopp 716f5c
  	/* Expand wildcards, supporting %:h and the like. */
Karsten Hopp 716f5c
  	ret = expand_wildcards_eval(&pat, num_file, file, flags);
Karsten Hopp 716f5c
  	if (free_pat)
Karsten Hopp 716f5c
*** ../vim-7.3.071/src/misc1.c	2010-08-16 21:46:12.000000000 +0200
Karsten Hopp 716f5c
--- src/misc1.c	2010-11-28 15:02:57.000000000 +0100
Karsten Hopp 716f5c
***************
Karsten Hopp 716f5c
*** 9161,9167 ****
Karsten Hopp 716f5c
  #ifdef CASE_INSENSITIVE_FILENAME
Karsten Hopp 716f5c
      regmatch.rm_ic = TRUE;		/* Behave like Terminal.app */
Karsten Hopp 716f5c
  #else
Karsten Hopp 716f5c
!     regmatch.rm_ic = FALSE;		/* Don't ever ignore case */
Karsten Hopp 716f5c
  #endif
Karsten Hopp 716f5c
      regmatch.regprog = vim_regcomp(pat, RE_MAGIC);
Karsten Hopp 716f5c
      vim_free(pat);
Karsten Hopp 716f5c
--- 9161,9170 ----
Karsten Hopp 716f5c
  #ifdef CASE_INSENSITIVE_FILENAME
Karsten Hopp 716f5c
      regmatch.rm_ic = TRUE;		/* Behave like Terminal.app */
Karsten Hopp 716f5c
  #else
Karsten Hopp 716f5c
!     if (flags & EW_ICASE)
Karsten Hopp 716f5c
! 	regmatch.rm_ic = TRUE;		/* 'wildignorecase' set */
Karsten Hopp 716f5c
!     else
Karsten Hopp 716f5c
! 	regmatch.rm_ic = FALSE;		/* Don't ignore case */
Karsten Hopp 716f5c
  #endif
Karsten Hopp 716f5c
      regmatch.regprog = vim_regcomp(pat, RE_MAGIC);
Karsten Hopp 716f5c
      vim_free(pat);
Karsten Hopp 716f5c
***************
Karsten Hopp 716f5c
*** 9643,9649 ****
Karsten Hopp 716f5c
      if (paths == NULL)
Karsten Hopp 716f5c
  	return 0;
Karsten Hopp 716f5c
  
Karsten Hopp 716f5c
!     files = globpath(paths, pattern, 0);
Karsten Hopp 716f5c
      vim_free(paths);
Karsten Hopp 716f5c
      if (files == NULL)
Karsten Hopp 716f5c
  	return 0;
Karsten Hopp 716f5c
--- 9646,9652 ----
Karsten Hopp 716f5c
      if (paths == NULL)
Karsten Hopp 716f5c
  	return 0;
Karsten Hopp 716f5c
  
Karsten Hopp 716f5c
!     files = globpath(paths, pattern, (flags & EW_ICASE) ? WILD_ICASE : 0);
Karsten Hopp 716f5c
      vim_free(paths);
Karsten Hopp 716f5c
      if (files == NULL)
Karsten Hopp 716f5c
  	return 0;
Karsten Hopp 716f5c
*** ../vim-7.3.071/src/option.c	2010-12-02 15:33:10.000000000 +0100
Karsten Hopp 716f5c
--- src/option.c	2010-12-02 15:12:02.000000000 +0100
Karsten Hopp 716f5c
***************
Karsten Hopp 716f5c
*** 2740,2746 ****
Karsten Hopp 716f5c
  			    (char_u *)&p_wc, PV_NONE,
Karsten Hopp 716f5c
  			    {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB}
Karsten Hopp 716f5c
  			    SCRIPTID_INIT},
Karsten Hopp 716f5c
!     {"wildcharm",   "wcm",   P_NUM|P_VI_DEF,
Karsten Hopp 716f5c
  			    (char_u *)&p_wcm, PV_NONE,
Karsten Hopp 716f5c
  			    {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
Karsten Hopp 716f5c
      {"wildignore",  "wig",  P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
Karsten Hopp 716f5c
--- 2740,2746 ----
Karsten Hopp 716f5c
  			    (char_u *)&p_wc, PV_NONE,
Karsten Hopp 716f5c
  			    {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB}
Karsten Hopp 716f5c
  			    SCRIPTID_INIT},
Karsten Hopp 716f5c
!     {"wildcharm",   "wcm",  P_NUM|P_VI_DEF,
Karsten Hopp 716f5c
  			    (char_u *)&p_wcm, PV_NONE,
Karsten Hopp 716f5c
  			    {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
Karsten Hopp 716f5c
      {"wildignore",  "wig",  P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
Karsten Hopp 716f5c
***************
Karsten Hopp 716f5c
*** 2750,2755 ****
Karsten Hopp 716f5c
--- 2750,2758 ----
Karsten Hopp 716f5c
  			    (char_u *)NULL, PV_NONE,
Karsten Hopp 716f5c
  #endif
Karsten Hopp 716f5c
  			    {(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
Karsten Hopp 716f5c
+     {"wildignorecase", "wic", P_BOOL|P_VI_DEF,
Karsten Hopp 716f5c
+ 			    (char_u *)&p_wic, PV_NONE,
Karsten Hopp 716f5c
+ 			    {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
Karsten Hopp 716f5c
      {"wildmenu",    "wmnu", P_BOOL|P_VI_DEF,
Karsten Hopp 716f5c
  #ifdef FEAT_WILDMENU
Karsten Hopp 716f5c
  			    (char_u *)&p_wmnu, PV_NONE,
Karsten Hopp 716f5c
*** ../vim-7.3.071/src/option.h	2010-08-15 21:57:28.000000000 +0200
Karsten Hopp 716f5c
--- src/option.h	2010-11-28 14:29:18.000000000 +0100
Karsten Hopp 716f5c
***************
Karsten Hopp 716f5c
*** 872,877 ****
Karsten Hopp 716f5c
--- 872,878 ----
Karsten Hopp 716f5c
  EXTERN char_u	*p_ww;		/* 'whichwrap' */
Karsten Hopp 716f5c
  EXTERN long	p_wc;		/* 'wildchar' */
Karsten Hopp 716f5c
  EXTERN long	p_wcm;		/* 'wildcharm' */
Karsten Hopp 716f5c
+ EXTERN long	p_wic;		/* 'wildignorecase' */
Karsten Hopp 716f5c
  EXTERN char_u	*p_wim;		/* 'wildmode' */
Karsten Hopp 716f5c
  #ifdef FEAT_WILDMENU
Karsten Hopp 716f5c
  EXTERN int	p_wmnu;		/* 'wildmenu' */
Karsten Hopp 716f5c
*** ../vim-7.3.071/src/vim.h	2010-10-20 19:17:43.000000000 +0200
Karsten Hopp 716f5c
--- src/vim.h	2010-11-28 14:49:02.000000000 +0100
Karsten Hopp 716f5c
***************
Karsten Hopp 716f5c
*** 798,803 ****
Karsten Hopp 716f5c
--- 798,804 ----
Karsten Hopp 716f5c
  #define WILD_KEEP_ALL		32
Karsten Hopp 716f5c
  #define WILD_SILENT		64
Karsten Hopp 716f5c
  #define WILD_ESCAPE		128
Karsten Hopp 716f5c
+ #define WILD_ICASE		256
Karsten Hopp 716f5c
  
Karsten Hopp 716f5c
  /* Flags for expand_wildcards() */
Karsten Hopp 716f5c
  #define EW_DIR		0x01	/* include directory names */
Karsten Hopp 716f5c
***************
Karsten Hopp 716f5c
*** 808,813 ****
Karsten Hopp 716f5c
--- 809,815 ----
Karsten Hopp 716f5c
  #define EW_SILENT	0x20	/* don't print "1 returned" from shell */
Karsten Hopp 716f5c
  #define EW_EXEC		0x40	/* executable files */
Karsten Hopp 716f5c
  #define EW_PATH		0x80	/* search in 'path' too */
Karsten Hopp 716f5c
+ #define EW_ICASE	0x100	/* ignore case */
Karsten Hopp 716f5c
  /* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
Karsten Hopp 716f5c
   * is used when executing commands and EW_SILENT for interactive expanding. */
Karsten Hopp 716f5c
  
Karsten Hopp 716f5c
*** ../vim-7.3.071/runtime/doc/options.txt	2010-10-20 17:44:01.000000000 +0200
Karsten Hopp 716f5c
--- runtime/doc/options.txt	2010-12-02 11:15:01.000000000 +0100
Karsten Hopp 716f5c
***************
Karsten Hopp 716f5c
*** 7748,7753 ****
Karsten Hopp 716f5c
--- 7756,7772 ----
Karsten Hopp 716f5c
  	a pattern from the list.  This avoids problems when a future version
Karsten Hopp 716f5c
  	uses another default.
Karsten Hopp 716f5c
  
Karsten Hopp 716f5c
+ 
Karsten Hopp 716f5c
+ 			*'wildignorecase* *'wic'* *'nowildignorecase* *'nowic'*
Karsten Hopp 716f5c
+ 'wildignorecase' 'wic'	boolean	(default off)
Karsten Hopp 716f5c
+ 			global
Karsten Hopp 716f5c
+ 			{not in Vi}
Karsten Hopp 716f5c
+ 	When set case is ignored when completing file names and directories.
Karsten Hopp 716f5c
+ 	Has no effect on systems where file name case is generally ignored.
Karsten Hopp 716f5c
+ 	Does not apply when the shell is used to expand wildcards, which
Karsten Hopp 716f5c
+ 	happens when there are special characters.
Karsten Hopp 716f5c
+ 
Karsten Hopp 716f5c
+ 
Karsten Hopp 716f5c
  				*'wildmenu'* *'wmnu'* *'nowildmenu'* *'nowmnu'*
Karsten Hopp 716f5c
  'wildmenu' 'wmnu'	boolean	(default off)
Karsten Hopp 716f5c
  			global
Karsten Hopp 716f5c
*** ../vim-7.3.071/src/version.c	2010-12-02 15:33:10.000000000 +0100
Karsten Hopp 716f5c
--- src/version.c	2010-12-02 15:57:14.000000000 +0100
Karsten Hopp 716f5c
***************
Karsten Hopp 716f5c
*** 716,717 ****
Karsten Hopp 716f5c
--- 716,719 ----
Karsten Hopp 716f5c
  {   /* Add new patch number below this line */
Karsten Hopp 716f5c
+ /**/
Karsten Hopp 716f5c
+     72,
Karsten Hopp 716f5c
  /**/
Karsten Hopp 716f5c
Karsten Hopp 716f5c
-- 
Karsten Hopp 716f5c
I recommend ordering large cargo containers of paper towels to make up
Karsten Hopp 716f5c
whatever budget underruns you have.  Paper products are always useful and they
Karsten Hopp 716f5c
have the advantage of being completely flushable if you need to make room in
Karsten Hopp 716f5c
the storage area later.
Karsten Hopp 716f5c
				(Scott Adams - The Dilbert principle)
Karsten Hopp 716f5c
Karsten Hopp 716f5c
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 716f5c
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 716f5c
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 716f5c
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///