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