Karsten Hopp efce84
To: vim_dev@googlegroups.com
Karsten Hopp efce84
Subject: Patch 7.3.1297
Karsten Hopp efce84
Fcc: outbox
Karsten Hopp efce84
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp efce84
Mime-Version: 1.0
Karsten Hopp efce84
Content-Type: text/plain; charset=UTF-8
Karsten Hopp efce84
Content-Transfer-Encoding: 8bit
Karsten Hopp efce84
------------
Karsten Hopp efce84
Karsten Hopp efce84
Patch 7.3.1297
Karsten Hopp efce84
Problem:    findfile() directory matching does not work when a star follows
Karsten Hopp efce84
	    text. (Markus Braun)
Karsten Hopp efce84
Solution:   Make a wildcard work properly. (Christian Brabandt)
Karsten Hopp efce84
Files:	    src/misc2.c, src/testdir/test89.in, src/testdir/test89.ok
Karsten Hopp efce84
Karsten Hopp efce84
Karsten Hopp efce84
*** ../vim-7.3.1296/src/misc2.c	2013-06-08 18:19:40.000000000 +0200
Karsten Hopp efce84
--- src/misc2.c	2013-07-03 17:09:52.000000000 +0200
Karsten Hopp efce84
***************
Karsten Hopp efce84
*** 4679,4686 ****
Karsten Hopp efce84
      }
Karsten Hopp efce84
      STRCPY(ff_expand_buffer, search_ctx->ffsc_start_dir);
Karsten Hopp efce84
      add_pathsep(ff_expand_buffer);
Karsten Hopp efce84
!     STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path);
Karsten Hopp efce84
!     add_pathsep(ff_expand_buffer);
Karsten Hopp efce84
  
Karsten Hopp efce84
      sptr = ff_create_stack_element(ff_expand_buffer,
Karsten Hopp efce84
  #ifdef FEAT_PATH_EXTRA
Karsten Hopp efce84
--- 4679,4736 ----
Karsten Hopp efce84
      }
Karsten Hopp efce84
      STRCPY(ff_expand_buffer, search_ctx->ffsc_start_dir);
Karsten Hopp efce84
      add_pathsep(ff_expand_buffer);
Karsten Hopp efce84
!     {
Karsten Hopp efce84
! 	char_u *buf = alloc(STRLEN(ff_expand_buffer)
Karsten Hopp efce84
! 					 + STRLEN(search_ctx->ffsc_fix_path));
Karsten Hopp efce84
! 
Karsten Hopp efce84
! 	STRCPY(buf, ff_expand_buffer);
Karsten Hopp efce84
! 	STRCAT(buf, search_ctx->ffsc_fix_path);
Karsten Hopp efce84
! 	if (mch_isdir(buf))
Karsten Hopp efce84
! 	{
Karsten Hopp efce84
! 	    STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path);
Karsten Hopp efce84
! 	    add_pathsep(ff_expand_buffer);
Karsten Hopp efce84
! 	}
Karsten Hopp efce84
! #ifdef FEAT_PATH_EXTRA
Karsten Hopp efce84
! 	else
Karsten Hopp efce84
! 	{
Karsten Hopp efce84
! 	    char_u *p =  vim_strrchr(search_ctx->ffsc_fix_path, PATHSEP);
Karsten Hopp efce84
! 	    char_u *wc_path = NUL;
Karsten Hopp efce84
! 	    char_u *temp = NUL;
Karsten Hopp efce84
! 	    int    len = 0;
Karsten Hopp efce84
! 
Karsten Hopp efce84
! 	    if (p != NULL)
Karsten Hopp efce84
! 	    {
Karsten Hopp efce84
! 		len = p - search_ctx->ffsc_fix_path;
Karsten Hopp efce84
! 		STRNCAT(ff_expand_buffer, search_ctx->ffsc_fix_path, len);
Karsten Hopp efce84
! 		add_pathsep(ff_expand_buffer);
Karsten Hopp efce84
! 	    }
Karsten Hopp efce84
! 	    else
Karsten Hopp efce84
! 		len = STRLEN(search_ctx->ffsc_fix_path);
Karsten Hopp efce84
! 
Karsten Hopp efce84
! 	    if (search_ctx->ffsc_wc_path != NULL)
Karsten Hopp efce84
! 	    {
Karsten Hopp efce84
! 		wc_path = vim_strsave(search_ctx->ffsc_wc_path);
Karsten Hopp efce84
! 		temp = alloc(STRLEN(search_ctx->ffsc_wc_path)
Karsten Hopp efce84
! 				 + (STRLEN(search_ctx->ffsc_fix_path) - len));
Karsten Hopp efce84
! 	    }
Karsten Hopp efce84
! 
Karsten Hopp efce84
! 	    if (temp == NULL || wc_path == NULL)
Karsten Hopp efce84
! 	    {
Karsten Hopp efce84
! 		vim_free(buf);
Karsten Hopp efce84
! 		vim_free(temp);
Karsten Hopp efce84
! 		vim_free(wc_path);
Karsten Hopp efce84
! 		goto error_return;
Karsten Hopp efce84
! 	    }
Karsten Hopp efce84
! 
Karsten Hopp efce84
! 	    STRCPY(temp, search_ctx->ffsc_fix_path + len);
Karsten Hopp efce84
! 	    STRCAT(temp, search_ctx->ffsc_wc_path);
Karsten Hopp efce84
! 	    vim_free(search_ctx->ffsc_wc_path);
Karsten Hopp efce84
! 	    vim_free(wc_path);
Karsten Hopp efce84
! 	    search_ctx->ffsc_wc_path = temp;
Karsten Hopp efce84
! 	}
Karsten Hopp efce84
! #endif
Karsten Hopp efce84
! 	vim_free(buf);
Karsten Hopp efce84
!     }
Karsten Hopp efce84
  
Karsten Hopp efce84
      sptr = ff_create_stack_element(ff_expand_buffer,
Karsten Hopp efce84
  #ifdef FEAT_PATH_EXTRA
Karsten Hopp efce84
*** ../vim-7.3.1296/src/testdir/test89.in	2013-06-04 22:13:45.000000000 +0200
Karsten Hopp efce84
--- src/testdir/test89.in	2013-07-03 17:06:20.000000000 +0200
Karsten Hopp efce84
***************
Karsten Hopp efce84
*** 1,6 ****
Karsten Hopp efce84
! Some tests for setting 'number' and 'relativenumber'
Karsten Hopp efce84
! This is not all that useful now that the options are no longer reset when
Karsten Hopp efce84
! setting the other.
Karsten Hopp efce84
  
Karsten Hopp efce84
  STARTTEST
Karsten Hopp efce84
  :so small.vim
Karsten Hopp efce84
--- 1,7 ----
Karsten Hopp efce84
! - Some tests for setting 'number' and 'relativenumber'
Karsten Hopp efce84
!   This is not all that useful now that the options are no longer reset when
Karsten Hopp efce84
!   setting the other.
Karsten Hopp efce84
! - Some tests for findfile() function
Karsten Hopp efce84
  
Karsten Hopp efce84
  STARTTEST
Karsten Hopp efce84
  :so small.vim
Karsten Hopp efce84
***************
Karsten Hopp efce84
*** 49,54 ****
Karsten Hopp efce84
--- 50,66 ----
Karsten Hopp efce84
  :$put g
Karsten Hopp efce84
  :$put h
Karsten Hopp efce84
  :"
Karsten Hopp efce84
+ :let cwd=getcwd()
Karsten Hopp efce84
+ :cd ../..
Karsten Hopp efce84
+ :$put =''
Karsten Hopp efce84
+ :$put ='Testing findfile'
Karsten Hopp efce84
+ :$put =''
Karsten Hopp efce84
+ :$put =findfile('test19.in','src/test*')
Karsten Hopp efce84
+ :exe "cd" cwd
Karsten Hopp efce84
+ :cd ..
Karsten Hopp efce84
+ :$put =findfile('test19.in','test*')
Karsten Hopp efce84
+ :$put =findfile('test19.in','testdir')
Karsten Hopp efce84
+ :exe "cd" cwd
Karsten Hopp efce84
  :/^results/,$w! test.out
Karsten Hopp efce84
  :q!
Karsten Hopp efce84
  ENDTEST
Karsten Hopp efce84
*** ../vim-7.3.1296/src/testdir/test89.ok	2013-06-04 22:13:45.000000000 +0200
Karsten Hopp efce84
--- src/testdir/test89.ok	2013-07-03 17:06:20.000000000 +0200
Karsten Hopp efce84
***************
Karsten Hopp efce84
*** 20,22 ****
Karsten Hopp efce84
--- 20,28 ----
Karsten Hopp efce84
    number
Karsten Hopp efce84
  
Karsten Hopp efce84
    relativenumber
Karsten Hopp efce84
+ 
Karsten Hopp efce84
+ Testing findfile
Karsten Hopp efce84
+ 
Karsten Hopp efce84
+ src/testdir/test19.in
Karsten Hopp efce84
+ testdir/test19.in
Karsten Hopp efce84
+ testdir/test19.in
Karsten Hopp efce84
*** ../vim-7.3.1296/src/version.c	2013-07-03 16:58:40.000000000 +0200
Karsten Hopp efce84
--- src/version.c	2013-07-03 17:02:56.000000000 +0200
Karsten Hopp efce84
***************
Karsten Hopp efce84
*** 730,731 ****
Karsten Hopp efce84
--- 730,733 ----
Karsten Hopp efce84
  {   /* Add new patch number below this line */
Karsten Hopp efce84
+ /**/
Karsten Hopp efce84
+     1297,
Karsten Hopp efce84
  /**/
Karsten Hopp efce84
Karsten Hopp efce84
-- 
Karsten Hopp efce84
Michael: There is no such thing as a dump question.
Karsten Hopp efce84
Bernard: Sure there is.  For example "what is a core dump?"
Karsten Hopp efce84
Karsten Hopp efce84
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp efce84
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp efce84
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp efce84
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///