Karsten Hopp 6eaecd
To: vim_dev@googlegroups.com
Karsten Hopp 6eaecd
Subject: Patch 7.3.789
Karsten Hopp 6eaecd
Fcc: outbox
Karsten Hopp 6eaecd
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 6eaecd
Mime-Version: 1.0
Karsten Hopp 6eaecd
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 6eaecd
Content-Transfer-Encoding: 8bit
Karsten Hopp 6eaecd
------------
Karsten Hopp 6eaecd
Karsten Hopp 6eaecd
Patch 7.3.789 (after 7.3.776)
Karsten Hopp 6eaecd
Problem:    "\k" in regexp does not work in other window.
Karsten Hopp 6eaecd
Solution:   Use the right buffer. (Yukihiro Nakadaira)
Karsten Hopp 6eaecd
Files:	    src/mbyte.c, src/proto/mbyte.pro, src/regexp.c
Karsten Hopp 6eaecd
Karsten Hopp 6eaecd
Karsten Hopp 6eaecd
*** ../vim-7.3.788/src/mbyte.c	2013-01-23 16:19:17.000000000 +0100
Karsten Hopp 6eaecd
--- src/mbyte.c	2013-01-30 13:53:07.000000000 +0100
Karsten Hopp 6eaecd
***************
Karsten Hopp 6eaecd
*** 869,879 ****
Karsten Hopp 6eaecd
  mb_get_class(p)
Karsten Hopp 6eaecd
      char_u	*p;
Karsten Hopp 6eaecd
  {
Karsten Hopp 6eaecd
      if (MB_BYTE2LEN(p[0]) == 1)
Karsten Hopp 6eaecd
      {
Karsten Hopp 6eaecd
  	if (p[0] == NUL || vim_iswhite(p[0]))
Karsten Hopp 6eaecd
  	    return 0;
Karsten Hopp 6eaecd
! 	if (vim_iswordc(p[0]))
Karsten Hopp 6eaecd
  	    return 2;
Karsten Hopp 6eaecd
  	return 1;
Karsten Hopp 6eaecd
      }
Karsten Hopp 6eaecd
--- 869,887 ----
Karsten Hopp 6eaecd
  mb_get_class(p)
Karsten Hopp 6eaecd
      char_u	*p;
Karsten Hopp 6eaecd
  {
Karsten Hopp 6eaecd
+     return mb_get_class_buf(p, curbuf);
Karsten Hopp 6eaecd
+ }
Karsten Hopp 6eaecd
+ 
Karsten Hopp 6eaecd
+     int
Karsten Hopp 6eaecd
+ mb_get_class_buf(p, buf)
Karsten Hopp 6eaecd
+     char_u	*p;
Karsten Hopp 6eaecd
+     buf_T	*buf;
Karsten Hopp 6eaecd
+ {
Karsten Hopp 6eaecd
      if (MB_BYTE2LEN(p[0]) == 1)
Karsten Hopp 6eaecd
      {
Karsten Hopp 6eaecd
  	if (p[0] == NUL || vim_iswhite(p[0]))
Karsten Hopp 6eaecd
  	    return 0;
Karsten Hopp 6eaecd
! 	if (vim_iswordc_buf(p[0], buf))
Karsten Hopp 6eaecd
  	    return 2;
Karsten Hopp 6eaecd
  	return 1;
Karsten Hopp 6eaecd
      }
Karsten Hopp 6eaecd
*** ../vim-7.3.788/src/proto/mbyte.pro	2011-08-10 13:21:30.000000000 +0200
Karsten Hopp 6eaecd
--- src/proto/mbyte.pro	2013-01-30 13:53:27.000000000 +0100
Karsten Hopp 6eaecd
***************
Karsten Hopp 6eaecd
*** 4,9 ****
Karsten Hopp 6eaecd
--- 4,10 ----
Karsten Hopp 6eaecd
  int bomb_size __ARGS((void));
Karsten Hopp 6eaecd
  void remove_bom __ARGS((char_u *s));
Karsten Hopp 6eaecd
  int mb_get_class __ARGS((char_u *p));
Karsten Hopp 6eaecd
+ int mb_get_class_buf __ARGS((char_u *p, buf_T *buf));
Karsten Hopp 6eaecd
  int dbcs_class __ARGS((unsigned lead, unsigned trail));
Karsten Hopp 6eaecd
  int latin_char2len __ARGS((int c));
Karsten Hopp 6eaecd
  int latin_char2bytes __ARGS((int c, char_u *buf));
Karsten Hopp 6eaecd
*** ../vim-7.3.788/src/regexp.c	2013-01-25 20:10:58.000000000 +0100
Karsten Hopp 6eaecd
--- src/regexp.c	2013-01-30 13:55:39.000000000 +0100
Karsten Hopp 6eaecd
***************
Karsten Hopp 6eaecd
*** 4013,4020 ****
Karsten Hopp 6eaecd
  reg_prev_class()
Karsten Hopp 6eaecd
  {
Karsten Hopp 6eaecd
      if (reginput > regline)
Karsten Hopp 6eaecd
! 	return mb_get_class(reginput - 1
Karsten Hopp 6eaecd
! 				     - (*mb_head_off)(regline, reginput - 1));
Karsten Hopp 6eaecd
      return -1;
Karsten Hopp 6eaecd
  }
Karsten Hopp 6eaecd
  
Karsten Hopp 6eaecd
--- 4013,4020 ----
Karsten Hopp 6eaecd
  reg_prev_class()
Karsten Hopp 6eaecd
  {
Karsten Hopp 6eaecd
      if (reginput > regline)
Karsten Hopp 6eaecd
! 	return mb_get_class_buf(reginput - 1
Karsten Hopp 6eaecd
! 			    - (*mb_head_off)(regline, reginput - 1), reg_buf);
Karsten Hopp 6eaecd
      return -1;
Karsten Hopp 6eaecd
  }
Karsten Hopp 6eaecd
  
Karsten Hopp 6eaecd
***************
Karsten Hopp 6eaecd
*** 4304,4310 ****
Karsten Hopp 6eaecd
  		int this_class;
Karsten Hopp 6eaecd
  
Karsten Hopp 6eaecd
  		/* Get class of current and previous char (if it exists). */
Karsten Hopp 6eaecd
! 		this_class = mb_get_class(reginput);
Karsten Hopp 6eaecd
  		if (this_class <= 1)
Karsten Hopp 6eaecd
  		    status = RA_NOMATCH;  /* not on a word at all */
Karsten Hopp 6eaecd
  		else if (reg_prev_class() == this_class)
Karsten Hopp 6eaecd
--- 4304,4310 ----
Karsten Hopp 6eaecd
  		int this_class;
Karsten Hopp 6eaecd
  
Karsten Hopp 6eaecd
  		/* Get class of current and previous char (if it exists). */
Karsten Hopp 6eaecd
! 		this_class = mb_get_class_buf(reginput, reg_buf);
Karsten Hopp 6eaecd
  		if (this_class <= 1)
Karsten Hopp 6eaecd
  		    status = RA_NOMATCH;  /* not on a word at all */
Karsten Hopp 6eaecd
  		else if (reg_prev_class() == this_class)
Karsten Hopp 6eaecd
***************
Karsten Hopp 6eaecd
*** 4328,4334 ****
Karsten Hopp 6eaecd
  		int this_class, prev_class;
Karsten Hopp 6eaecd
  
Karsten Hopp 6eaecd
  		/* Get class of current and previous char (if it exists). */
Karsten Hopp 6eaecd
! 		this_class = mb_get_class(reginput);
Karsten Hopp 6eaecd
  		prev_class = reg_prev_class();
Karsten Hopp 6eaecd
  		if (this_class == prev_class
Karsten Hopp 6eaecd
  			|| prev_class == 0 || prev_class == 1)
Karsten Hopp 6eaecd
--- 4328,4334 ----
Karsten Hopp 6eaecd
  		int this_class, prev_class;
Karsten Hopp 6eaecd
  
Karsten Hopp 6eaecd
  		/* Get class of current and previous char (if it exists). */
Karsten Hopp 6eaecd
! 		this_class = mb_get_class_buf(reginput, reg_buf);
Karsten Hopp 6eaecd
  		prev_class = reg_prev_class();
Karsten Hopp 6eaecd
  		if (this_class == prev_class
Karsten Hopp 6eaecd
  			|| prev_class == 0 || prev_class == 1)
Karsten Hopp 6eaecd
***************
Karsten Hopp 6eaecd
*** 4365,4378 ****
Karsten Hopp 6eaecd
  	    break;
Karsten Hopp 6eaecd
  
Karsten Hopp 6eaecd
  	  case KWORD:
Karsten Hopp 6eaecd
! 	    if (!vim_iswordp(reginput))
Karsten Hopp 6eaecd
  		status = RA_NOMATCH;
Karsten Hopp 6eaecd
  	    else
Karsten Hopp 6eaecd
  		ADVANCE_REGINPUT();
Karsten Hopp 6eaecd
  	    break;
Karsten Hopp 6eaecd
  
Karsten Hopp 6eaecd
  	  case SKWORD:
Karsten Hopp 6eaecd
! 	    if (VIM_ISDIGIT(*reginput) || !vim_iswordp(reginput))
Karsten Hopp 6eaecd
  		status = RA_NOMATCH;
Karsten Hopp 6eaecd
  	    else
Karsten Hopp 6eaecd
  		ADVANCE_REGINPUT();
Karsten Hopp 6eaecd
--- 4365,4378 ----
Karsten Hopp 6eaecd
  	    break;
Karsten Hopp 6eaecd
  
Karsten Hopp 6eaecd
  	  case KWORD:
Karsten Hopp 6eaecd
! 	    if (!vim_iswordp_buf(reginput, reg_buf))
Karsten Hopp 6eaecd
  		status = RA_NOMATCH;
Karsten Hopp 6eaecd
  	    else
Karsten Hopp 6eaecd
  		ADVANCE_REGINPUT();
Karsten Hopp 6eaecd
  	    break;
Karsten Hopp 6eaecd
  
Karsten Hopp 6eaecd
  	  case SKWORD:
Karsten Hopp 6eaecd
! 	    if (VIM_ISDIGIT(*reginput) || !vim_iswordp_buf(reginput, reg_buf))
Karsten Hopp 6eaecd
  		status = RA_NOMATCH;
Karsten Hopp 6eaecd
  	    else
Karsten Hopp 6eaecd
  		ADVANCE_REGINPUT();
Karsten Hopp 6eaecd
***************
Karsten Hopp 6eaecd
*** 5734,5740 ****
Karsten Hopp 6eaecd
        case SKWORD + ADD_NL:
Karsten Hopp 6eaecd
  	while (count < maxcount)
Karsten Hopp 6eaecd
  	{
Karsten Hopp 6eaecd
! 	    if (vim_iswordp(scan) && (testval || !VIM_ISDIGIT(*scan)))
Karsten Hopp 6eaecd
  	    {
Karsten Hopp 6eaecd
  		mb_ptr_adv(scan);
Karsten Hopp 6eaecd
  	    }
Karsten Hopp 6eaecd
--- 5734,5741 ----
Karsten Hopp 6eaecd
        case SKWORD + ADD_NL:
Karsten Hopp 6eaecd
  	while (count < maxcount)
Karsten Hopp 6eaecd
  	{
Karsten Hopp 6eaecd
! 	    if (vim_iswordp_buf(scan, reg_buf)
Karsten Hopp 6eaecd
! 					  && (testval || !VIM_ISDIGIT(*scan)))
Karsten Hopp 6eaecd
  	    {
Karsten Hopp 6eaecd
  		mb_ptr_adv(scan);
Karsten Hopp 6eaecd
  	    }
Karsten Hopp 6eaecd
*** ../vim-7.3.788/src/version.c	2013-01-30 12:50:50.000000000 +0100
Karsten Hopp 6eaecd
--- src/version.c	2013-01-30 13:58:07.000000000 +0100
Karsten Hopp 6eaecd
***************
Karsten Hopp 6eaecd
*** 727,728 ****
Karsten Hopp 6eaecd
--- 727,730 ----
Karsten Hopp 6eaecd
  {   /* Add new patch number below this line */
Karsten Hopp 6eaecd
+ /**/
Karsten Hopp 6eaecd
+     789,
Karsten Hopp 6eaecd
  /**/
Karsten Hopp 6eaecd
Karsten Hopp 6eaecd
-- 
Karsten Hopp 6eaecd
MARTHA'S WAY: Don't throw out all that leftover wine. Freeze into ice cubes
Karsten Hopp 6eaecd
              for future use in casseroles and sauces.
Karsten Hopp 6eaecd
MY WAY:       What leftover wine?
Karsten Hopp 6eaecd
Karsten Hopp 6eaecd
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 6eaecd
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 6eaecd
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 6eaecd
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///