Karsten Hopp 31ba1b
To: vim-dev@vim.org
Karsten Hopp 31ba1b
Subject: Patch 7.1.233
Karsten Hopp 31ba1b
Fcc: outbox
Karsten Hopp 31ba1b
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 31ba1b
Mime-Version: 1.0
Karsten Hopp 31ba1b
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 31ba1b
Content-Transfer-Encoding: 8bit
Karsten Hopp 31ba1b
------------
Karsten Hopp 31ba1b
Karsten Hopp 31ba1b
Patch 7.1.233
Karsten Hopp 31ba1b
Problem:    Crash when doing Insert mode completion for a user defined
Karsten Hopp 31ba1b
	    command.  (Yegappan Lakshmanan)
Karsten Hopp 31ba1b
Solution:   Don't use the non-existing command line.
Karsten Hopp 31ba1b
Files:	    src/ex_getln.c
Karsten Hopp 31ba1b
Karsten Hopp 31ba1b
Karsten Hopp 31ba1b
*** ../vim-7.1.232/src/ex_getln.c	Fri Jan  4 15:16:57 2008
Karsten Hopp 31ba1b
--- src/ex_getln.c	Fri Jan 18 13:07:11 2008
Karsten Hopp 31ba1b
***************
Karsten Hopp 31ba1b
*** 4655,4661 ****
Karsten Hopp 31ba1b
  static void * call_user_expand_func __ARGS((void *(*user_expand_func) __ARGS((char_u *, int, char_u **, int)), expand_T	*xp, int *num_file, char_u ***file));
Karsten Hopp 31ba1b
  
Karsten Hopp 31ba1b
  /*
Karsten Hopp 31ba1b
!  * call "user_expand_func()" to invoke a user defined VimL function and return
Karsten Hopp 31ba1b
   * the result (either a string or a List).
Karsten Hopp 31ba1b
   */
Karsten Hopp 31ba1b
      static void *
Karsten Hopp 31ba1b
--- 4655,4661 ----
Karsten Hopp 31ba1b
  static void * call_user_expand_func __ARGS((void *(*user_expand_func) __ARGS((char_u *, int, char_u **, int)), expand_T	*xp, int *num_file, char_u ***file));
Karsten Hopp 31ba1b
  
Karsten Hopp 31ba1b
  /*
Karsten Hopp 31ba1b
!  * Call "user_expand_func()" to invoke a user defined VimL function and return
Karsten Hopp 31ba1b
   * the result (either a string or a List).
Karsten Hopp 31ba1b
   */
Karsten Hopp 31ba1b
      static void *
Karsten Hopp 31ba1b
***************
Karsten Hopp 31ba1b
*** 4677,4687 ****
Karsten Hopp 31ba1b
      *num_file = 0;
Karsten Hopp 31ba1b
      *file = NULL;
Karsten Hopp 31ba1b
  
Karsten Hopp 31ba1b
!     keep = ccline.cmdbuff[ccline.cmdlen];
Karsten Hopp 31ba1b
!     ccline.cmdbuff[ccline.cmdlen] = 0;
Karsten Hopp 31ba1b
!     sprintf((char *)num, "%d", ccline.cmdpos);
Karsten Hopp 31ba1b
      args[0] = xp->xp_pattern;
Karsten Hopp 31ba1b
-     args[1] = ccline.cmdbuff;
Karsten Hopp 31ba1b
      args[2] = num;
Karsten Hopp 31ba1b
  
Karsten Hopp 31ba1b
      /* Save the cmdline, we don't know what the function may do. */
Karsten Hopp 31ba1b
--- 4677,4698 ----
Karsten Hopp 31ba1b
      *num_file = 0;
Karsten Hopp 31ba1b
      *file = NULL;
Karsten Hopp 31ba1b
  
Karsten Hopp 31ba1b
!     if (ccline.cmdbuff == NULL)
Karsten Hopp 31ba1b
!     {
Karsten Hopp 31ba1b
! 	/* Completion from Insert mode, pass fake arguments. */
Karsten Hopp 31ba1b
! 	keep = 0;
Karsten Hopp 31ba1b
! 	sprintf((char *)num, "%d", STRLEN(xp->xp_pattern));
Karsten Hopp 31ba1b
! 	args[1] = xp->xp_pattern;
Karsten Hopp 31ba1b
!     }
Karsten Hopp 31ba1b
!     else
Karsten Hopp 31ba1b
!     {
Karsten Hopp 31ba1b
! 	/* Completion on the command line, pass real arguments. */
Karsten Hopp 31ba1b
! 	keep = ccline.cmdbuff[ccline.cmdlen];
Karsten Hopp 31ba1b
! 	ccline.cmdbuff[ccline.cmdlen] = 0;
Karsten Hopp 31ba1b
! 	sprintf((char *)num, "%d", ccline.cmdpos);
Karsten Hopp 31ba1b
! 	args[1] = ccline.cmdbuff;
Karsten Hopp 31ba1b
!     }
Karsten Hopp 31ba1b
      args[0] = xp->xp_pattern;
Karsten Hopp 31ba1b
      args[2] = num;
Karsten Hopp 31ba1b
  
Karsten Hopp 31ba1b
      /* Save the cmdline, we don't know what the function may do. */
Karsten Hopp 31ba1b
***************
Karsten Hopp 31ba1b
*** 4694,4701 ****
Karsten Hopp 31ba1b
  
Karsten Hopp 31ba1b
      ccline = save_ccline;
Karsten Hopp 31ba1b
      current_SID = save_current_SID;
Karsten Hopp 31ba1b
! 
Karsten Hopp 31ba1b
!     ccline.cmdbuff[ccline.cmdlen] = keep;
Karsten Hopp 31ba1b
  
Karsten Hopp 31ba1b
      return ret;
Karsten Hopp 31ba1b
  }
Karsten Hopp 31ba1b
--- 4705,4712 ----
Karsten Hopp 31ba1b
  
Karsten Hopp 31ba1b
      ccline = save_ccline;
Karsten Hopp 31ba1b
      current_SID = save_current_SID;
Karsten Hopp 31ba1b
!     if (ccline.cmdbuff != NULL)
Karsten Hopp 31ba1b
! 	ccline.cmdbuff[ccline.cmdlen] = keep;
Karsten Hopp 31ba1b
  
Karsten Hopp 31ba1b
      return ret;
Karsten Hopp 31ba1b
  }
Karsten Hopp 31ba1b
*** ../vim-7.1.232/src/version.c	Fri Jan 18 11:40:02 2008
Karsten Hopp 31ba1b
--- src/version.c	Fri Jan 18 13:01:05 2008
Karsten Hopp 31ba1b
***************
Karsten Hopp 31ba1b
*** 668,669 ****
Karsten Hopp 31ba1b
--- 668,671 ----
Karsten Hopp 31ba1b
  {   /* Add new patch number below this line */
Karsten Hopp 31ba1b
+ /**/
Karsten Hopp 31ba1b
+     233,
Karsten Hopp 31ba1b
  /**/
Karsten Hopp 31ba1b
Karsten Hopp 31ba1b
-- 
Karsten Hopp 31ba1b
"I love deadlines.  I especially like the whooshing sound they
Karsten Hopp 31ba1b
make as they go flying by."
Karsten Hopp 31ba1b
                         -- Douglas Adams
Karsten Hopp 31ba1b
Karsten Hopp 31ba1b
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 31ba1b
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 31ba1b
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 31ba1b
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///