Karsten Hopp 81c285
To: vim-dev@vim.org
Karsten Hopp 81c285
Subject: Patch 7.2.224
Karsten Hopp 81c285
Fcc: outbox
Karsten Hopp 81c285
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 81c285
Mime-Version: 1.0
Karsten Hopp 81c285
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 81c285
Content-Transfer-Encoding: 8bit
Karsten Hopp 81c285
------------
Karsten Hopp 81c285
Karsten Hopp 81c285
Patch 7.2.224
Karsten Hopp 81c285
Problem:    Crash when using 'completefunc'. (Ingo Karkat)
Karsten Hopp 81c285
Solution:   Disallow entering edit() recursively when doing completion.
Karsten Hopp 81c285
Files:	    src/edit.c
Karsten Hopp 81c285
Karsten Hopp 81c285
Karsten Hopp 81c285
*** ../vim-7.2.223/src/edit.c	2009-05-26 11:01:43.000000000 +0200
Karsten Hopp 81c285
--- src/edit.c	2009-07-09 18:01:49.000000000 +0200
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 114,119 ****
Karsten Hopp 81c285
--- 114,123 ----
Karsten Hopp 81c285
   * FALSE the word to be completed must be located. */
Karsten Hopp 81c285
  static int	  compl_started = FALSE;
Karsten Hopp 81c285
  
Karsten Hopp 81c285
+ /* Set when doing something for completion that may call edit() recursively,
Karsten Hopp 81c285
+  * which is not allowed. */
Karsten Hopp 81c285
+ static int	  compl_busy = FALSE;
Karsten Hopp 81c285
+ 
Karsten Hopp 81c285
  static int	  compl_matches = 0;
Karsten Hopp 81c285
  static char_u	  *compl_pattern = NULL;
Karsten Hopp 81c285
  static int	  compl_direction = FORWARD;
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 346,352 ****
Karsten Hopp 81c285
  
Karsten Hopp 81c285
  #ifdef FEAT_INS_EXPAND
Karsten Hopp 81c285
      /* Don't allow recursive insert mode when busy with completion. */
Karsten Hopp 81c285
!     if (compl_started || pum_visible())
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	EMSG(_(e_secure));
Karsten Hopp 81c285
  	return FALSE;
Karsten Hopp 81c285
--- 350,356 ----
Karsten Hopp 81c285
  
Karsten Hopp 81c285
  #ifdef FEAT_INS_EXPAND
Karsten Hopp 81c285
      /* Don't allow recursive insert mode when busy with completion. */
Karsten Hopp 81c285
!     if (compl_started || compl_busy || pum_visible())
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	EMSG(_(e_secure));
Karsten Hopp 81c285
  	return FALSE;
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 1340,1347 ****
Karsten Hopp 81c285
--- 1344,1353 ----
Karsten Hopp 81c285
  		goto normalchar;
Karsten Hopp 81c285
  
Karsten Hopp 81c285
  docomplete:
Karsten Hopp 81c285
+ 	    compl_busy = TRUE;
Karsten Hopp 81c285
  	    if (ins_complete(c) == FAIL)
Karsten Hopp 81c285
  		compl_cont_status = 0;
Karsten Hopp 81c285
+ 	    compl_busy = FALSE;
Karsten Hopp 81c285
  	    break;
Karsten Hopp 81c285
  #endif /* FEAT_INS_EXPAND */
Karsten Hopp 81c285
  
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 3172,3177 ****
Karsten Hopp 81c285
--- 3178,3184 ----
Karsten Hopp 81c285
  	vim_free(match);
Karsten Hopp 81c285
      } while (compl_curr_match != NULL && compl_curr_match != compl_first_match);
Karsten Hopp 81c285
      compl_first_match = compl_curr_match = NULL;
Karsten Hopp 81c285
+     compl_shown_match = NULL;
Karsten Hopp 81c285
  }
Karsten Hopp 81c285
  
Karsten Hopp 81c285
      static void
Karsten Hopp 81c285
*** ../vim-7.2.223/src/version.c	2009-07-09 15:55:34.000000000 +0200
Karsten Hopp 81c285
--- src/version.c	2009-07-09 18:14:16.000000000 +0200
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 678,679 ****
Karsten Hopp 81c285
--- 678,681 ----
Karsten Hopp 81c285
  {   /* Add new patch number below this line */
Karsten Hopp 81c285
+ /**/
Karsten Hopp 81c285
+     224,
Karsten Hopp 81c285
  /**/
Karsten Hopp 81c285
Karsten Hopp 81c285
-- 
Karsten Hopp 81c285
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 81c285
77. The phone company asks you to test drive their new PBX system
Karsten Hopp 81c285
Karsten Hopp 81c285
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 81c285
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 81c285
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 81c285
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///