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