dcaee6
To: vim_dev@googlegroups.com
dcaee6
Subject: Patch 7.4.159
dcaee6
Fcc: outbox
dcaee6
From: Bram Moolenaar <Bram@moolenaar.net>
dcaee6
Mime-Version: 1.0
dcaee6
Content-Type: text/plain; charset=UTF-8
dcaee6
Content-Transfer-Encoding: 8bit
dcaee6
------------
dcaee6
dcaee6
Patch 7.4.159
dcaee6
Problem:    Completion hangs when scanning the current buffer after doing
dcaee6
	    keywords. (Christian Brabandt)
dcaee6
Solution:   Set the first match position when starting to scan the current
dcaee6
	    buffer.
dcaee6
Files:	    src/edit.c
dcaee6
dcaee6
dcaee6
*** ../vim-7.4.158/src/edit.c	2014-01-14 12:16:57.000000000 +0100
dcaee6
--- src/edit.c	2014-01-23 22:42:20.964121311 +0100
dcaee6
***************
dcaee6
*** 4180,4185 ****
dcaee6
--- 4180,4186 ----
dcaee6
      char_u	*dict = NULL;
dcaee6
      int		dict_f = 0;
dcaee6
      compl_T	*old_match;
dcaee6
+     int		set_match_pos;
dcaee6
  
dcaee6
      if (!compl_started)
dcaee6
      {
dcaee6
***************
dcaee6
*** 4198,4203 ****
dcaee6
--- 4199,4205 ----
dcaee6
      for (;;)
dcaee6
      {
dcaee6
  	found_new_match = FAIL;
dcaee6
+ 	set_match_pos = FALSE;
dcaee6
  
dcaee6
  	/* For ^N/^P pick a new entry from e_cpt if compl_started is off,
dcaee6
  	 * or if found_all says this entry is done.  For ^X^L only use the
dcaee6
***************
dcaee6
*** 4217,4222 ****
dcaee6
--- 4219,4228 ----
dcaee6
  		    dec(&first_match_pos);
dcaee6
  		last_match_pos = first_match_pos;
dcaee6
  		type = 0;
dcaee6
+ 
dcaee6
+ 		/* Remember the first match so that the loop stops when we
dcaee6
+ 		 * wrap and come back there a second time. */
dcaee6
+ 		set_match_pos = TRUE;
dcaee6
  	    }
dcaee6
  	    else if (vim_strchr((char_u *)"buwU", *e_cpt) != NULL
dcaee6
  		 && (ins_buf = ins_compl_next_buf(ins_buf, *e_cpt)) != curbuf)
dcaee6
***************
dcaee6
*** 4381,4387 ****
dcaee6
  	    if (ins_buf->b_p_inf)
dcaee6
  		p_scs = FALSE;
dcaee6
  
dcaee6
! 	    /*	buffers other than curbuf are scanned from the beginning or the
dcaee6
  	     *	end but never from the middle, thus setting nowrapscan in this
dcaee6
  	     *	buffers is a good idea, on the other hand, we always set
dcaee6
  	     *	wrapscan for curbuf to avoid missing matches -- Acevedo,Webb */
dcaee6
--- 4387,4393 ----
dcaee6
  	    if (ins_buf->b_p_inf)
dcaee6
  		p_scs = FALSE;
dcaee6
  
dcaee6
! 	    /*	Buffers other than curbuf are scanned from the beginning or the
dcaee6
  	     *	end but never from the middle, thus setting nowrapscan in this
dcaee6
  	     *	buffers is a good idea, on the other hand, we always set
dcaee6
  	     *	wrapscan for curbuf to avoid missing matches -- Acevedo,Webb */
dcaee6
***************
dcaee6
*** 4408,4419 ****
dcaee6
  				 compl_pattern, 1L, SEARCH_KEEP + SEARCH_NFMSG,
dcaee6
  						  RE_LAST, (linenr_T)0, NULL);
dcaee6
  		--msg_silent;
dcaee6
! 		if (!compl_started)
dcaee6
  		{
dcaee6
  		    /* set "compl_started" even on fail */
dcaee6
  		    compl_started = TRUE;
dcaee6
  		    first_match_pos = *pos;
dcaee6
  		    last_match_pos = *pos;
dcaee6
  		}
dcaee6
  		else if (first_match_pos.lnum == last_match_pos.lnum
dcaee6
  				 && first_match_pos.col == last_match_pos.col)
dcaee6
--- 4414,4426 ----
dcaee6
  				 compl_pattern, 1L, SEARCH_KEEP + SEARCH_NFMSG,
dcaee6
  						  RE_LAST, (linenr_T)0, NULL);
dcaee6
  		--msg_silent;
dcaee6
! 		if (!compl_started || set_match_pos)
dcaee6
  		{
dcaee6
  		    /* set "compl_started" even on fail */
dcaee6
  		    compl_started = TRUE;
dcaee6
  		    first_match_pos = *pos;
dcaee6
  		    last_match_pos = *pos;
dcaee6
+ 		    set_match_pos = FALSE;
dcaee6
  		}
dcaee6
  		else if (first_match_pos.lnum == last_match_pos.lnum
dcaee6
  				 && first_match_pos.col == last_match_pos.col)
dcaee6
*** ../vim-7.4.158/src/version.c	2014-01-23 20:09:29.523869260 +0100
dcaee6
--- src/version.c	2014-01-23 22:44:40.908125157 +0100
dcaee6
***************
dcaee6
*** 740,741 ****
dcaee6
--- 740,743 ----
dcaee6
  {   /* Add new patch number below this line */
dcaee6
+ /**/
dcaee6
+     159,
dcaee6
  /**/
dcaee6
dcaee6
-- 
dcaee6
hundred-and-one symptoms of being an internet addict:
dcaee6
205. You're constantly yelling at your spouse, family, roommate, whatever,
dcaee6
     for using the phone for stupid things...like talking.
dcaee6
dcaee6
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
dcaee6
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
dcaee6
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
dcaee6
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///