Blame SOURCES/7.4.292

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