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