Blame SOURCES/7.4.159

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