Karsten Hopp ae61a4
To: vim_dev@googlegroups.com
Karsten Hopp ae61a4
Subject: Patch 7.3.999
Karsten Hopp ae61a4
Fcc: outbox
Karsten Hopp ae61a4
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp ae61a4
Mime-Version: 1.0
Karsten Hopp ae61a4
Content-Type: text/plain; charset=UTF-8
Karsten Hopp ae61a4
Content-Transfer-Encoding: 8bit
Karsten Hopp ae61a4
------------
Karsten Hopp ae61a4
Karsten Hopp ae61a4
Patch 7.3.999
Karsten Hopp ae61a4
Problem:    New regexp engine sets curbuf temporarily.
Karsten Hopp ae61a4
Solution:   Use reg_buf instead, like the old engine.
Karsten Hopp ae61a4
Files:	    src/regexp_nfa.c
Karsten Hopp ae61a4
Karsten Hopp ae61a4
Karsten Hopp ae61a4
*** ../vim-7.3.998/src/regexp_nfa.c	2013-05-21 16:28:05.000000000 +0200
Karsten Hopp ae61a4
--- src/regexp_nfa.c	2013-05-21 21:15:41.000000000 +0200
Karsten Hopp ae61a4
***************
Karsten Hopp ae61a4
*** 3125,3139 ****
Karsten Hopp ae61a4
  		    int this_class;
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  		    /* Get class of current and previous char (if it exists). */
Karsten Hopp ae61a4
! 		    this_class = mb_get_class(reginput);
Karsten Hopp ae61a4
  		    if (this_class <= 1)
Karsten Hopp ae61a4
  			bow = FALSE;
Karsten Hopp ae61a4
  		    else if (reg_prev_class() == this_class)
Karsten Hopp ae61a4
  			bow = FALSE;
Karsten Hopp ae61a4
  		}
Karsten Hopp ae61a4
  #endif
Karsten Hopp ae61a4
! 		else if (!vim_iswordc(c)
Karsten Hopp ae61a4
! 			|| (reginput > regline && vim_iswordc(reginput[-1])))
Karsten Hopp ae61a4
  		    bow = FALSE;
Karsten Hopp ae61a4
  		if (bow)
Karsten Hopp ae61a4
  		    addstate(thislist, t->state->out, &t->sub, 0, listid,
Karsten Hopp ae61a4
--- 3125,3140 ----
Karsten Hopp ae61a4
  		    int this_class;
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  		    /* Get class of current and previous char (if it exists). */
Karsten Hopp ae61a4
! 		    this_class = mb_get_class_buf(reginput, reg_buf);
Karsten Hopp ae61a4
  		    if (this_class <= 1)
Karsten Hopp ae61a4
  			bow = FALSE;
Karsten Hopp ae61a4
  		    else if (reg_prev_class() == this_class)
Karsten Hopp ae61a4
  			bow = FALSE;
Karsten Hopp ae61a4
  		}
Karsten Hopp ae61a4
  #endif
Karsten Hopp ae61a4
! 		else if (!vim_iswordc_buf(c, reg_buf)
Karsten Hopp ae61a4
! 			   || (reginput > regline
Karsten Hopp ae61a4
! 				   && vim_iswordc_buf(reginput[-1], reg_buf)))
Karsten Hopp ae61a4
  		    bow = FALSE;
Karsten Hopp ae61a4
  		if (bow)
Karsten Hopp ae61a4
  		    addstate(thislist, t->state->out, &t->sub, 0, listid,
Karsten Hopp ae61a4
***************
Karsten Hopp ae61a4
*** 3153,3167 ****
Karsten Hopp ae61a4
  		    int this_class, prev_class;
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  		    /* Get class of current and previous char (if it exists). */
Karsten Hopp ae61a4
! 		    this_class = mb_get_class(reginput);
Karsten Hopp ae61a4
  		    prev_class = reg_prev_class();
Karsten Hopp ae61a4
  		    if (this_class == prev_class
Karsten Hopp ae61a4
  					|| prev_class == 0 || prev_class == 1)
Karsten Hopp ae61a4
  			eow = FALSE;
Karsten Hopp ae61a4
  		}
Karsten Hopp ae61a4
  #endif
Karsten Hopp ae61a4
! 		else if (!vim_iswordc(reginput[-1])
Karsten Hopp ae61a4
! 				    || (reginput[0] != NUL && vim_iswordc(c)))
Karsten Hopp ae61a4
  		    eow = FALSE;
Karsten Hopp ae61a4
  		if (eow)
Karsten Hopp ae61a4
  		    addstate(thislist, t->state->out, &t->sub, 0, listid,
Karsten Hopp ae61a4
--- 3154,3168 ----
Karsten Hopp ae61a4
  		    int this_class, prev_class;
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  		    /* Get class of current and previous char (if it exists). */
Karsten Hopp ae61a4
! 		    this_class = mb_get_class_buf(reginput, reg_buf);
Karsten Hopp ae61a4
  		    prev_class = reg_prev_class();
Karsten Hopp ae61a4
  		    if (this_class == prev_class
Karsten Hopp ae61a4
  					|| prev_class == 0 || prev_class == 1)
Karsten Hopp ae61a4
  			eow = FALSE;
Karsten Hopp ae61a4
  		}
Karsten Hopp ae61a4
  #endif
Karsten Hopp ae61a4
! 		else if (!vim_iswordc_buf(reginput[-1], reg_buf)
Karsten Hopp ae61a4
! 			|| (reginput[0] != NUL && vim_iswordc_buf(c, reg_buf)))
Karsten Hopp ae61a4
  		    eow = FALSE;
Karsten Hopp ae61a4
  		if (eow)
Karsten Hopp ae61a4
  		    addstate(thislist, t->state->out, &t->sub, 0, listid,
Karsten Hopp ae61a4
***************
Karsten Hopp ae61a4
*** 3267,3278 ****
Karsten Hopp ae61a4
  		break;
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  	    case NFA_KWORD:	/*  \k	*/
Karsten Hopp ae61a4
! 		result = vim_iswordp(reginput);
Karsten Hopp ae61a4
  		ADD_POS_NEG_STATE(t->state);
Karsten Hopp ae61a4
  		break;
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  	    case NFA_SKWORD:	/*  \K	*/
Karsten Hopp ae61a4
! 		result = !VIM_ISDIGIT(c) && vim_iswordp(reginput);
Karsten Hopp ae61a4
  		ADD_POS_NEG_STATE(t->state);
Karsten Hopp ae61a4
  		break;
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
--- 3268,3279 ----
Karsten Hopp ae61a4
  		break;
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  	    case NFA_KWORD:	/*  \k	*/
Karsten Hopp ae61a4
! 		result = vim_iswordp_buf(reginput, reg_buf);
Karsten Hopp ae61a4
  		ADD_POS_NEG_STATE(t->state);
Karsten Hopp ae61a4
  		break;
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  	    case NFA_SKWORD:	/*  \K	*/
Karsten Hopp ae61a4
! 		result = !VIM_ISDIGIT(c) && vim_iswordp_buf(reginput, reg_buf);
Karsten Hopp ae61a4
  		ADD_POS_NEG_STATE(t->state);
Karsten Hopp ae61a4
  		break;
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
***************
Karsten Hopp ae61a4
*** 3826,3834 ****
Karsten Hopp ae61a4
      colnr_T	col;		/* column to start looking for match */
Karsten Hopp ae61a4
      proftime_T	*tm UNUSED;	/* timeout limit or NULL */
Karsten Hopp ae61a4
  {
Karsten Hopp ae61a4
-     long	r;
Karsten Hopp ae61a4
-     buf_T	*save_curbuf = curbuf;
Karsten Hopp ae61a4
- 
Karsten Hopp ae61a4
      reg_match = NULL;
Karsten Hopp ae61a4
      reg_mmatch = rmp;
Karsten Hopp ae61a4
      reg_buf = buf;
Karsten Hopp ae61a4
--- 3827,3832 ----
Karsten Hopp ae61a4
***************
Karsten Hopp ae61a4
*** 3842,3853 ****
Karsten Hopp ae61a4
  #endif
Karsten Hopp ae61a4
      ireg_maxcol = rmp->rmm_maxcol;
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
!     /* Need to switch to buffer "buf" to make vim_iswordc() work. */
Karsten Hopp ae61a4
!     curbuf = buf;
Karsten Hopp ae61a4
!     r = nfa_regexec_both(NULL, col);
Karsten Hopp ae61a4
!     curbuf = save_curbuf;
Karsten Hopp ae61a4
! 
Karsten Hopp ae61a4
!     return r;
Karsten Hopp ae61a4
  }
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  #ifdef DEBUG
Karsten Hopp ae61a4
--- 3840,3846 ----
Karsten Hopp ae61a4
  #endif
Karsten Hopp ae61a4
      ireg_maxcol = rmp->rmm_maxcol;
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
!     return nfa_regexec_both(NULL, col);
Karsten Hopp ae61a4
  }
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  #ifdef DEBUG
Karsten Hopp ae61a4
*** ../vim-7.3.998/src/version.c	2013-05-21 20:51:55.000000000 +0200
Karsten Hopp ae61a4
--- src/version.c	2013-05-21 21:16:32.000000000 +0200
Karsten Hopp ae61a4
***************
Karsten Hopp ae61a4
*** 730,731 ****
Karsten Hopp ae61a4
--- 730,733 ----
Karsten Hopp ae61a4
  {   /* Add new patch number below this line */
Karsten Hopp ae61a4
+ /**/
Karsten Hopp ae61a4
+     999,
Karsten Hopp ae61a4
  /**/
Karsten Hopp ae61a4
Karsten Hopp ae61a4
-- 
Karsten Hopp ae61a4
SOLDIER: Where did you get the coconuts?
Karsten Hopp ae61a4
ARTHUR:  Through ... We found them.
Karsten Hopp ae61a4
SOLDIER: Found them?  In Mercea.  The coconut's tropical!
Karsten Hopp ae61a4
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp ae61a4
Karsten Hopp ae61a4
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp ae61a4
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp ae61a4
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp ae61a4
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///