jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.532

3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.532
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.532
3ef2ca
Problem:    When using 'incsearch' "2/pattern/e" highlights the first match.
3ef2ca
Solution:   Move the code to set extra_col inside the loop for count.  (Ozaki
3ef2ca
	    Kiichi)
3ef2ca
Files:	    src/search.c
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.531/src/search.c	2014-06-17 13:50:06.148087184 +0200
3ef2ca
--- src/search.c	2014-11-27 17:21:49.579489220 +0100
3ef2ca
***************
3ef2ca
*** 552,557 ****
3ef2ca
--- 552,558 ----
3ef2ca
      int		match_ok;
3ef2ca
      long	nmatched;
3ef2ca
      int		submatch = 0;
3ef2ca
+     int		first_match = TRUE;
3ef2ca
      int		save_called_emsg = called_emsg;
3ef2ca
  #ifdef FEAT_SEARCH_EXTRA
3ef2ca
      int		break_loop = FALSE;
3ef2ca
***************
3ef2ca
*** 565,597 ****
3ef2ca
  	return FAIL;
3ef2ca
      }
3ef2ca
  
3ef2ca
-     /* When not accepting a match at the start position set "extra_col" to a
3ef2ca
-      * non-zero value.  Don't do that when starting at MAXCOL, since MAXCOL +
3ef2ca
-      * 1 is zero. */
3ef2ca
-     if ((options & SEARCH_START) || pos->col == MAXCOL)
3ef2ca
- 	extra_col = 0;
3ef2ca
- #ifdef FEAT_MBYTE
3ef2ca
-     /* Watch out for the "col" being MAXCOL - 2, used in a closed fold. */
3ef2ca
-     else if (dir != BACKWARD && has_mbyte
3ef2ca
- 		    && pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count
3ef2ca
- 						     && pos->col < MAXCOL - 2)
3ef2ca
-     {
3ef2ca
- 	ptr = ml_get_buf(buf, pos->lnum, FALSE) + pos->col;
3ef2ca
- 	if (*ptr == NUL)
3ef2ca
- 	    extra_col = 1;
3ef2ca
- 	else
3ef2ca
- 	    extra_col = (*mb_ptr2len)(ptr);
3ef2ca
-     }
3ef2ca
- #endif
3ef2ca
-     else
3ef2ca
- 	extra_col = 1;
3ef2ca
- 
3ef2ca
      /*
3ef2ca
       * find the string
3ef2ca
       */
3ef2ca
      called_emsg = FALSE;
3ef2ca
      do	/* loop for count */
3ef2ca
      {
3ef2ca
  	start_pos = *pos;	/* remember start pos for detecting no match */
3ef2ca
  	found = 0;		/* default: not found */
3ef2ca
  	at_first_line = TRUE;	/* default: start in first line */
3ef2ca
--- 566,598 ----
3ef2ca
  	return FAIL;
3ef2ca
      }
3ef2ca
  
3ef2ca
      /*
3ef2ca
       * find the string
3ef2ca
       */
3ef2ca
      called_emsg = FALSE;
3ef2ca
      do	/* loop for count */
3ef2ca
      {
3ef2ca
+ 	/* When not accepting a match at the start position set "extra_col" to
3ef2ca
+ 	 * a non-zero value.  Don't do that when starting at MAXCOL, since
3ef2ca
+ 	 * MAXCOL + 1 is zero. */
3ef2ca
+ 	if ((options & SEARCH_START) || pos->col == MAXCOL)
3ef2ca
+ 	    extra_col = 0;
3ef2ca
+ #ifdef FEAT_MBYTE
3ef2ca
+ 	/* Watch out for the "col" being MAXCOL - 2, used in a closed fold. */
3ef2ca
+ 	else if (dir != BACKWARD && has_mbyte
3ef2ca
+ 		     && pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count
3ef2ca
+ 						     && pos->col < MAXCOL - 2)
3ef2ca
+ 	{
3ef2ca
+ 	    ptr = ml_get_buf(buf, pos->lnum, FALSE) + pos->col;
3ef2ca
+ 	    if (*ptr == NUL)
3ef2ca
+ 		extra_col = 1;
3ef2ca
+ 	    else
3ef2ca
+ 		extra_col = (*mb_ptr2len)(ptr);
3ef2ca
+ 	}
3ef2ca
+ #endif
3ef2ca
+ 	else
3ef2ca
+ 	    extra_col = 1;
3ef2ca
+ 
3ef2ca
  	start_pos = *pos;	/* remember start pos for detecting no match */
3ef2ca
  	found = 0;		/* default: not found */
3ef2ca
  	at_first_line = TRUE;	/* default: start in first line */
3ef2ca
***************
3ef2ca
*** 677,683 ****
3ef2ca
  			 * otherwise "/$" will get stuck on end of line.
3ef2ca
  			 */
3ef2ca
  			while (matchpos.lnum == 0
3ef2ca
! 				&& ((options & SEARCH_END)
3ef2ca
  				    ?  (nmatched == 1
3ef2ca
  					&& (int)endpos.col - 1
3ef2ca
  					     < (int)start_pos.col + extra_col)
3ef2ca
--- 678,684 ----
3ef2ca
  			 * otherwise "/$" will get stuck on end of line.
3ef2ca
  			 */
3ef2ca
  			while (matchpos.lnum == 0
3ef2ca
! 				&& ((options & SEARCH_END) && first_match
3ef2ca
  				    ?  (nmatched == 1
3ef2ca
  					&& (int)endpos.col - 1
3ef2ca
  					     < (int)start_pos.col + extra_col)
3ef2ca
***************
3ef2ca
*** 908,913 ****
3ef2ca
--- 909,915 ----
3ef2ca
  		    pos->coladd = 0;
3ef2ca
  #endif
3ef2ca
  		    found = 1;
3ef2ca
+ 		    first_match = FALSE;
3ef2ca
  
3ef2ca
  		    /* Set variables used for 'incsearch' highlighting. */
3ef2ca
  		    search_match_lines = endpos.lnum - matchpos.lnum;
3ef2ca
*** ../vim-7.4.531/src/version.c	2014-11-27 16:38:07.652261234 +0100
3ef2ca
--- src/version.c	2014-11-27 17:29:13.762616760 +0100
3ef2ca
***************
3ef2ca
*** 743,744 ****
3ef2ca
--- 743,746 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     532,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
The most powerful force in the universe is gossip.
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    ///