Karsten Hopp 5cd855
To: vim_dev@googlegroups.com
Karsten Hopp 5cd855
Subject: Patch 7.4.292
Karsten Hopp 5cd855
Fcc: outbox
Karsten Hopp 5cd855
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 5cd855
Mime-Version: 1.0
Karsten Hopp 5cd855
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 5cd855
Content-Transfer-Encoding: 8bit
Karsten Hopp 5cd855
------------
Karsten Hopp 5cd855
Karsten Hopp 5cd855
Patch 7.4.292
Karsten Hopp 5cd855
Problem:    Searching for "a" does not match accented "a" with new regexp
Karsten Hopp 5cd855
	    engine, does match with old engine. (David Bürgin)
Karsten Hopp 5cd855
	    "ca" does not match "ca" with accented "a" with either engine.
Karsten Hopp 5cd855
Solution:   Change the old engine, check for following composing character
Karsten Hopp 5cd855
	    also for single-byte patterns.
Karsten Hopp 5cd855
Files:	    src/regexp.c, src/testdir/test95.in, src/testdir/test95.ok
Karsten Hopp 5cd855
Karsten Hopp 5cd855
Karsten Hopp 5cd855
*** ../vim-7.4.291/src/regexp.c	2014-05-13 16:46:25.693696760 +0200
Karsten Hopp 5cd855
--- src/regexp.c	2014-05-13 17:45:50.977727970 +0200
Karsten Hopp 5cd855
***************
Karsten Hopp 5cd855
*** 4692,4722 ****
Karsten Hopp 5cd855
  		    /* match empty string always works; happens when "~" is
Karsten Hopp 5cd855
  		     * empty. */
Karsten Hopp 5cd855
  		}
Karsten Hopp 5cd855
! 		else if (opnd[1] == NUL
Karsten Hopp 5cd855
  #ifdef FEAT_MBYTE
Karsten Hopp 5cd855
  			    && !(enc_utf8 && ireg_ic)
Karsten Hopp 5cd855
  #endif
Karsten Hopp 5cd855
  			)
Karsten Hopp 5cd855
! 		    ++reginput;		/* matched a single char */
Karsten Hopp 5cd855
! 		else
Karsten Hopp 5cd855
! 		{
Karsten Hopp 5cd855
! 		    len = (int)STRLEN(opnd);
Karsten Hopp 5cd855
! 		    /* Need to match first byte again for multi-byte. */
Karsten Hopp 5cd855
! 		    if (cstrncmp(opnd, reginput, &len) != 0)
Karsten Hopp 5cd855
! 			status = RA_NOMATCH;
Karsten Hopp 5cd855
  #ifdef FEAT_MBYTE
Karsten Hopp 5cd855
  		    /* Check for following composing character. */
Karsten Hopp 5cd855
! 		    else if (enc_utf8
Karsten Hopp 5cd855
! 			       && UTF_COMPOSINGLIKE(reginput, reginput + len))
Karsten Hopp 5cd855
  		    {
Karsten Hopp 5cd855
  			/* raaron: This code makes a composing character get
Karsten Hopp 5cd855
  			 * ignored, which is the correct behavior (sometimes)
Karsten Hopp 5cd855
  			 * for voweled Hebrew texts. */
Karsten Hopp 5cd855
! 			if (!ireg_icombine)
Karsten Hopp 5cd855
! 			    status = RA_NOMATCH;
Karsten Hopp 5cd855
  		    }
Karsten Hopp 5cd855
  #endif
Karsten Hopp 5cd855
! 		    else
Karsten Hopp 5cd855
  			reginput += len;
Karsten Hopp 5cd855
  		}
Karsten Hopp 5cd855
  	    }
Karsten Hopp 5cd855
--- 4692,4728 ----
Karsten Hopp 5cd855
  		    /* match empty string always works; happens when "~" is
Karsten Hopp 5cd855
  		     * empty. */
Karsten Hopp 5cd855
  		}
Karsten Hopp 5cd855
! 		else
Karsten Hopp 5cd855
! 		{
Karsten Hopp 5cd855
! 		    if (opnd[1] == NUL
Karsten Hopp 5cd855
  #ifdef FEAT_MBYTE
Karsten Hopp 5cd855
  			    && !(enc_utf8 && ireg_ic)
Karsten Hopp 5cd855
  #endif
Karsten Hopp 5cd855
  			)
Karsten Hopp 5cd855
! 		    {
Karsten Hopp 5cd855
! 			len = 1;	/* matched a single byte above */
Karsten Hopp 5cd855
! 		    }
Karsten Hopp 5cd855
! 		    else
Karsten Hopp 5cd855
! 		    {
Karsten Hopp 5cd855
! 			/* Need to match first byte again for multi-byte. */
Karsten Hopp 5cd855
! 			len = (int)STRLEN(opnd);
Karsten Hopp 5cd855
! 			if (cstrncmp(opnd, reginput, &len) != 0)
Karsten Hopp 5cd855
! 			    status = RA_NOMATCH;
Karsten Hopp 5cd855
! 		    }
Karsten Hopp 5cd855
  #ifdef FEAT_MBYTE
Karsten Hopp 5cd855
  		    /* Check for following composing character. */
Karsten Hopp 5cd855
! 		    if (status != RA_NOMATCH
Karsten Hopp 5cd855
! 			    && enc_utf8
Karsten Hopp 5cd855
! 			    && UTF_COMPOSINGLIKE(reginput, reginput + len)
Karsten Hopp 5cd855
! 			    && !ireg_icombine)
Karsten Hopp 5cd855
  		    {
Karsten Hopp 5cd855
  			/* raaron: This code makes a composing character get
Karsten Hopp 5cd855
  			 * ignored, which is the correct behavior (sometimes)
Karsten Hopp 5cd855
  			 * for voweled Hebrew texts. */
Karsten Hopp 5cd855
! 			status = RA_NOMATCH;
Karsten Hopp 5cd855
  		    }
Karsten Hopp 5cd855
  #endif
Karsten Hopp 5cd855
! 		    if (status != RA_NOMATCH)
Karsten Hopp 5cd855
  			reginput += len;
Karsten Hopp 5cd855
  		}
Karsten Hopp 5cd855
  	    }
Karsten Hopp 5cd855
*** ../vim-7.4.291/src/testdir/test95.in	2013-07-21 16:53:52.000000000 +0200
Karsten Hopp 5cd855
--- src/testdir/test95.in	2014-05-13 17:49:00.201729626 +0200
Karsten Hopp 5cd855
***************
Karsten Hopp 5cd855
*** 50,55 ****
Karsten Hopp 5cd855
--- 50,57 ----
Karsten Hopp 5cd855
  :call add(tl, [2, ".\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"])
Karsten Hopp 5cd855
  :call add(tl, [1, "\u05b9\u05bb", " y\u05b9 x\u05b9\u05bb ", "x\u05b9\u05bb"])
Karsten Hopp 5cd855
  :call add(tl, [2, ".\u05b9\u05bb", " y\u05bb x\u05b9\u05bb ", "x\u05b9\u05bb"])
Karsten Hopp 5cd855
+ :call add(tl, [2, "a", "ca\u0300t"])
Karsten Hopp 5cd855
+ :call add(tl, [2, "a\u0300", "ca\u0300t", "a\u0300"])
Karsten Hopp 5cd855
  
Karsten Hopp 5cd855
  
Karsten Hopp 5cd855
  :"""" Test \Z
Karsten Hopp 5cd855
*** ../vim-7.4.291/src/testdir/test95.ok	2013-07-21 17:01:22.000000000 +0200
Karsten Hopp 5cd855
--- src/testdir/test95.ok	2014-05-13 17:49:46.709730033 +0200
Karsten Hopp 5cd855
***************
Karsten Hopp 5cd855
*** 67,72 ****
Karsten Hopp 5cd855
--- 67,78 ----
Karsten Hopp 5cd855
  OK 0 - .ֹֻ
Karsten Hopp 5cd855
  OK 1 - .ֹֻ
Karsten Hopp 5cd855
  OK 2 - .ֹֻ
Karsten Hopp 5cd855
+ OK 0 - a
Karsten Hopp 5cd855
+ OK 1 - a
Karsten Hopp 5cd855
+ OK 2 - a
Karsten Hopp 5cd855
+ OK 0 - à
Karsten Hopp 5cd855
+ OK 1 - à
Karsten Hopp 5cd855
+ OK 2 - à
Karsten Hopp 5cd855
  OK 0 - ú\Z
Karsten Hopp 5cd855
  OK 1 - ú\Z
Karsten Hopp 5cd855
  OK 2 - ú\Z
Karsten Hopp 5cd855
*** ../vim-7.4.291/src/version.c	2014-05-13 16:46:25.693696760 +0200
Karsten Hopp 5cd855
--- src/version.c	2014-05-13 18:00:22.149735596 +0200
Karsten Hopp 5cd855
***************
Karsten Hopp 5cd855
*** 736,737 ****
Karsten Hopp 5cd855
--- 736,739 ----
Karsten Hopp 5cd855
  {   /* Add new patch number below this line */
Karsten Hopp 5cd855
+ /**/
Karsten Hopp 5cd855
+     292,
Karsten Hopp 5cd855
  /**/
Karsten Hopp 5cd855
Karsten Hopp 5cd855
-- 
Karsten Hopp 5cd855
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 5cd855
154. You fondle your mouse.
Karsten Hopp 5cd855
Karsten Hopp 5cd855
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 5cd855
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 5cd855
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 5cd855
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///