Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.0.061
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.0.061
Problem:    Insert mode completion for Vim commands may crash if there is
	    nothing to complete.
Solution:   Instead of freeing the pattern make it empty, so that a "not
	    found" error is given. (Yukihiro Nakadaira)
Files:	    src/edit.c


*** ../vim-7.0.060/src/edit.c	Wed Aug 16 16:24:58 2006
--- src/edit.c	Wed Aug 16 21:20:29 2006
***************
*** 4691,4708 ****
  				     (int)STRLEN(compl_pattern), curs_col);
  	    if (compl_xp.xp_context == EXPAND_UNSUCCESSFUL
  		    || compl_xp.xp_context == EXPAND_NOTHING)
! 	    {
  		compl_col = curs_col;
- 		compl_length = 0;
- 		vim_free(compl_pattern);
- 		compl_pattern = NULL;
- 	    }
  	    else
! 	    {
! 		startcol = (int)(compl_xp.xp_pattern - compl_pattern);
! 		compl_col = startcol;
! 		compl_length = curs_col - startcol;
! 	    }
  	}
  	else if (ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode == CTRL_X_OMNI)
  	{
--- 4692,4703 ----
  				     (int)STRLEN(compl_pattern), curs_col);
  	    if (compl_xp.xp_context == EXPAND_UNSUCCESSFUL
  		    || compl_xp.xp_context == EXPAND_NOTHING)
! 		/* No completion possible, use an empty pattern to get a
! 		 * "pattern not found" message. */
  		compl_col = curs_col;
  	    else
! 		compl_col = (int)(compl_xp.xp_pattern - compl_pattern);
! 	    compl_length = curs_col - compl_col;
  	}
  	else if (ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode == CTRL_X_OMNI)
  	{
*** ../vim-7.0.060/src/version.c	Wed Aug 16 19:34:59 2006
--- src/version.c	Wed Aug 16 21:25:03 2006
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     61,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
165. You have a web page burned into your glasses

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///