0
0
mirror of https://github.com/vim/vim.git synced 2025-09-12 22:53:38 -04:00

updated for version 7.4.292

Problem:    Searching for "a" does not match accented "a" with new regexp
            engine, does match with old engine. (David Bürgin)
            "ca" does not match "ca" with accented "a" with either engine.
Solution:   Change the old engine, check for following composing character
            also for single-byte patterns.
This commit is contained in:
Bram Moolenaar 2014-05-13 18:04:00 +02:00
parent 6e13207d82
commit 6082bea6ac
4 changed files with 29 additions and 13 deletions

View File

@ -4692,31 +4692,37 @@ regmatch(scan)
/* match empty string always works; happens when "~" is /* match empty string always works; happens when "~" is
* empty. */ * empty. */
} }
else if (opnd[1] == NUL else
{
if (opnd[1] == NUL
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
&& !(enc_utf8 && ireg_ic) && !(enc_utf8 && ireg_ic)
#endif #endif
) )
++reginput; /* matched a single char */ {
len = 1; /* matched a single byte above */
}
else else
{ {
len = (int)STRLEN(opnd);
/* Need to match first byte again for multi-byte. */ /* Need to match first byte again for multi-byte. */
len = (int)STRLEN(opnd);
if (cstrncmp(opnd, reginput, &len) != 0) if (cstrncmp(opnd, reginput, &len) != 0)
status = RA_NOMATCH; status = RA_NOMATCH;
}
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
/* Check for following composing character. */ /* Check for following composing character. */
else if (enc_utf8 if (status != RA_NOMATCH
&& UTF_COMPOSINGLIKE(reginput, reginput + len)) && enc_utf8
&& UTF_COMPOSINGLIKE(reginput, reginput + len)
&& !ireg_icombine)
{ {
/* raaron: This code makes a composing character get /* raaron: This code makes a composing character get
* ignored, which is the correct behavior (sometimes) * ignored, which is the correct behavior (sometimes)
* for voweled Hebrew texts. */ * for voweled Hebrew texts. */
if (!ireg_icombine)
status = RA_NOMATCH; status = RA_NOMATCH;
} }
#endif #endif
else if (status != RA_NOMATCH)
reginput += len; reginput += len;
} }
} }

View File

@ -50,6 +50,8 @@ STARTTEST
:call add(tl, [2, ".\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"]) :call add(tl, [2, ".\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"])
:call add(tl, [1, "\u05b9\u05bb", " y\u05b9 x\u05b9\u05bb ", "x\u05b9\u05bb"]) :call add(tl, [1, "\u05b9\u05bb", " y\u05b9 x\u05b9\u05bb ", "x\u05b9\u05bb"])
:call add(tl, [2, ".\u05b9\u05bb", " y\u05bb x\u05b9\u05bb ", "x\u05b9\u05bb"]) :call add(tl, [2, ".\u05b9\u05bb", " y\u05bb x\u05b9\u05bb ", "x\u05b9\u05bb"])
:call add(tl, [2, "a", "ca\u0300t"])
:call add(tl, [2, "a\u0300", "ca\u0300t", "a\u0300"])
:"""" Test \Z :"""" Test \Z

View File

@ -67,6 +67,12 @@ OK 2 - ֹֻ
OK 0 - .ֹֻ OK 0 - .ֹֻ
OK 1 - .ֹֻ OK 1 - .ֹֻ
OK 2 - .ֹֻ OK 2 - .ֹֻ
OK 0 - a
OK 1 - a
OK 2 - a
OK 0 - à
OK 1 - à
OK 2 - à
OK 0 - ú\Z OK 0 - ú\Z
OK 1 - ú\Z OK 1 - ú\Z
OK 2 - ú\Z OK 2 - ú\Z

View File

@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
292,
/**/ /**/
291, 291,
/**/ /**/