Karsten Hopp 664dc2
To: vim_dev@googlegroups.com
Karsten Hopp 664dc2
Subject: Patch 7.3.264
Karsten Hopp 664dc2
Fcc: outbox
Karsten Hopp 664dc2
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 664dc2
Mime-Version: 1.0
Karsten Hopp 664dc2
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 664dc2
Content-Transfer-Encoding: 8bit
Karsten Hopp 664dc2
------------
Karsten Hopp 664dc2
Karsten Hopp 664dc2
Patch 7.3.264
Karsten Hopp 664dc2
Problem:    When the current directory name contains wildcard characters, such
Karsten Hopp 664dc2
	    as "foo[with]bar", the tags file can't be found.  (Jeremy
Karsten Hopp 664dc2
	    Erickson)
Karsten Hopp 664dc2
Solution:   When searching for matching files also match without expanding
Karsten Hopp 664dc2
	    wildcards.  This is a bit of a hack.
Karsten Hopp 664dc2
Files:	    src/vim.h, src/misc1.c, src/misc2.c
Karsten Hopp 664dc2
Karsten Hopp 664dc2
Karsten Hopp 664dc2
*** ../vim-7.3.263/src/vim.h	2011-07-20 15:04:52.000000000 +0200
Karsten Hopp 664dc2
--- src/vim.h	2011-07-27 16:21:38.000000000 +0200
Karsten Hopp 664dc2
***************
Karsten Hopp 664dc2
*** 816,821 ****
Karsten Hopp 664dc2
--- 816,822 ----
Karsten Hopp 664dc2
  #define EW_PATH		0x80	/* search in 'path' too */
Karsten Hopp 664dc2
  #define EW_ICASE	0x100	/* ignore case */
Karsten Hopp 664dc2
  #define EW_NOERROR	0x200	/* no error for bad regexp */
Karsten Hopp 664dc2
+ #define EW_NOTWILD	0x400	/* add match with literal name if exists */
Karsten Hopp 664dc2
  /* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
Karsten Hopp 664dc2
   * is used when executing commands and EW_SILENT for interactive expanding. */
Karsten Hopp 664dc2
  
Karsten Hopp 664dc2
*** ../vim-7.3.263/src/misc1.c	2011-07-20 15:04:52.000000000 +0200
Karsten Hopp 664dc2
--- src/misc1.c	2011-07-27 17:24:39.000000000 +0200
Karsten Hopp 664dc2
***************
Karsten Hopp 664dc2
*** 9119,9125 ****
Karsten Hopp 664dc2
  	 * all entries found with "matchname". */
Karsten Hopp 664dc2
  	if ((p[0] != '.' || starts_with_dot)
Karsten Hopp 664dc2
  		&& (matchname == NULL
Karsten Hopp 664dc2
! 		    || vim_regexec(&regmatch, p, (colnr_T)0)))
Karsten Hopp 664dc2
  	{
Karsten Hopp 664dc2
  #ifdef WIN3264
Karsten Hopp 664dc2
  	    STRCPY(s, p);
Karsten Hopp 664dc2
--- 9119,9127 ----
Karsten Hopp 664dc2
  	 * all entries found with "matchname". */
Karsten Hopp 664dc2
  	if ((p[0] != '.' || starts_with_dot)
Karsten Hopp 664dc2
  		&& (matchname == NULL
Karsten Hopp 664dc2
! 		  || vim_regexec(&regmatch, p, (colnr_T)0)
Karsten Hopp 664dc2
! 		  || ((flags & EW_NOTWILD)
Karsten Hopp 664dc2
! 		     && fnamencmp(path + (s - buf), p, e - s) == 0)))
Karsten Hopp 664dc2
  	{
Karsten Hopp 664dc2
  #ifdef WIN3264
Karsten Hopp 664dc2
  	    STRCPY(s, p);
Karsten Hopp 664dc2
***************
Karsten Hopp 664dc2
*** 9323,9329 ****
Karsten Hopp 664dc2
      e = p;
Karsten Hopp 664dc2
      *e = NUL;
Karsten Hopp 664dc2
  
Karsten Hopp 664dc2
!     /* now we have one wildcard component between "s" and "e" */
Karsten Hopp 664dc2
      /* Remove backslashes between "wildoff" and the start of the wildcard
Karsten Hopp 664dc2
       * component. */
Karsten Hopp 664dc2
      for (p = buf + wildoff; p < s; ++p)
Karsten Hopp 664dc2
--- 9325,9331 ----
Karsten Hopp 664dc2
      e = p;
Karsten Hopp 664dc2
      *e = NUL;
Karsten Hopp 664dc2
  
Karsten Hopp 664dc2
!     /* Now we have one wildcard component between "s" and "e". */
Karsten Hopp 664dc2
      /* Remove backslashes between "wildoff" and the start of the wildcard
Karsten Hopp 664dc2
       * component. */
Karsten Hopp 664dc2
      for (p = buf + wildoff; p < s; ++p)
Karsten Hopp 664dc2
***************
Karsten Hopp 664dc2
*** 9390,9396 ****
Karsten Hopp 664dc2
  	    if (dp == NULL)
Karsten Hopp 664dc2
  		break;
Karsten Hopp 664dc2
  	    if ((dp->d_name[0] != '.' || starts_with_dot)
Karsten Hopp 664dc2
! 		    && vim_regexec(&regmatch, (char_u *)dp->d_name, (colnr_T)0))
Karsten Hopp 664dc2
  	    {
Karsten Hopp 664dc2
  		STRCPY(s, dp->d_name);
Karsten Hopp 664dc2
  		len = STRLEN(buf);
Karsten Hopp 664dc2
--- 9392,9400 ----
Karsten Hopp 664dc2
  	    if (dp == NULL)
Karsten Hopp 664dc2
  		break;
Karsten Hopp 664dc2
  	    if ((dp->d_name[0] != '.' || starts_with_dot)
Karsten Hopp 664dc2
! 		 && (vim_regexec(&regmatch, (char_u *)dp->d_name, (colnr_T)0)
Karsten Hopp 664dc2
! 		   || ((flags & EW_NOTWILD)
Karsten Hopp 664dc2
! 		     && fnamencmp(path + (s - buf), dp->d_name, e - s) == 0)))
Karsten Hopp 664dc2
  	    {
Karsten Hopp 664dc2
  		STRCPY(s, dp->d_name);
Karsten Hopp 664dc2
  		len = STRLEN(buf);
Karsten Hopp 664dc2
*** ../vim-7.3.263/src/misc2.c	2011-07-07 17:15:29.000000000 +0200
Karsten Hopp 664dc2
--- src/misc2.c	2011-07-27 17:21:10.000000000 +0200
Karsten Hopp 664dc2
***************
Karsten Hopp 664dc2
*** 4653,4661 ****
Karsten Hopp 664dc2
      {
Karsten Hopp 664dc2
  	if (r_ptr[0] == '\\' && r_ptr[1] == ';')
Karsten Hopp 664dc2
  	{
Karsten Hopp 664dc2
! 	    /* overwrite the escape char,
Karsten Hopp 664dc2
! 	     * use STRLEN(r_ptr) to move the trailing '\0'
Karsten Hopp 664dc2
! 	     */
Karsten Hopp 664dc2
  	    STRMOVE(r_ptr, r_ptr + 1);
Karsten Hopp 664dc2
  	    r_ptr++;
Karsten Hopp 664dc2
  	}
Karsten Hopp 664dc2
--- 4653,4660 ----
Karsten Hopp 664dc2
      {
Karsten Hopp 664dc2
  	if (r_ptr[0] == '\\' && r_ptr[1] == ';')
Karsten Hopp 664dc2
  	{
Karsten Hopp 664dc2
! 	    /* Overwrite the escape char,
Karsten Hopp 664dc2
! 	     * use STRLEN(r_ptr) to move the trailing '\0'. */
Karsten Hopp 664dc2
  	    STRMOVE(r_ptr, r_ptr + 1);
Karsten Hopp 664dc2
  	    r_ptr++;
Karsten Hopp 664dc2
  	}
Karsten Hopp 664dc2
***************
Karsten Hopp 664dc2
*** 4914,4923 ****
Karsten Hopp 664dc2
  			stackp->ffs_filearray_size = 0;
Karsten Hopp 664dc2
  		}
Karsten Hopp 664dc2
  		else
Karsten Hopp 664dc2
  		    expand_wildcards((dirptrs[1] == NULL) ? 1 : 2, dirptrs,
Karsten Hopp 664dc2
  			    &stackp->ffs_filearray_size,
Karsten Hopp 664dc2
  			    &stackp->ffs_filearray,
Karsten Hopp 664dc2
! 			    EW_DIR|EW_ADDSLASH|EW_SILENT);
Karsten Hopp 664dc2
  
Karsten Hopp 664dc2
  		stackp->ffs_filearray_cur = 0;
Karsten Hopp 664dc2
  		stackp->ffs_stage = 0;
Karsten Hopp 664dc2
--- 4913,4925 ----
Karsten Hopp 664dc2
  			stackp->ffs_filearray_size = 0;
Karsten Hopp 664dc2
  		}
Karsten Hopp 664dc2
  		else
Karsten Hopp 664dc2
+ 		    /* Add EW_NOTWILD because the expanded path may contain
Karsten Hopp 664dc2
+ 		     * wildcard characters that are to be taken literally.
Karsten Hopp 664dc2
+ 		     * This is a bit of a hack. */
Karsten Hopp 664dc2
  		    expand_wildcards((dirptrs[1] == NULL) ? 1 : 2, dirptrs,
Karsten Hopp 664dc2
  			    &stackp->ffs_filearray_size,
Karsten Hopp 664dc2
  			    &stackp->ffs_filearray,
Karsten Hopp 664dc2
! 			    EW_DIR|EW_ADDSLASH|EW_SILENT|EW_NOTWILD);
Karsten Hopp 664dc2
  
Karsten Hopp 664dc2
  		stackp->ffs_filearray_cur = 0;
Karsten Hopp 664dc2
  		stackp->ffs_stage = 0;
Karsten Hopp 664dc2
*** ../vim-7.3.263/src/version.c	2011-07-27 14:15:41.000000000 +0200
Karsten Hopp 664dc2
--- src/version.c	2011-07-27 17:25:44.000000000 +0200
Karsten Hopp 664dc2
***************
Karsten Hopp 664dc2
*** 711,712 ****
Karsten Hopp 664dc2
--- 711,714 ----
Karsten Hopp 664dc2
  {   /* Add new patch number below this line */
Karsten Hopp 664dc2
+ /**/
Karsten Hopp 664dc2
+     264,
Karsten Hopp 664dc2
  /**/
Karsten Hopp 664dc2
Karsten Hopp 664dc2
-- 
Karsten Hopp 664dc2
CUSTOMER:     You're not fooling anyone y'know.  Look, isn't there something
Karsten Hopp 664dc2
              you can do?
Karsten Hopp 664dc2
DEAD PERSON:  I feel happy... I feel happy.
Karsten Hopp 664dc2
    [whop]
Karsten Hopp 664dc2
CUSTOMER:     Ah, thanks very much.
Karsten Hopp 664dc2
MORTICIAN:    Not at all.  See you on Thursday.
Karsten Hopp 664dc2
CUSTOMER:     Right.
Karsten Hopp 664dc2
                                  The Quest for the Holy Grail (Monty Python)
Karsten Hopp 664dc2
Karsten Hopp 664dc2
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 664dc2
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 664dc2
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 664dc2
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///