summaryrefslogtreecommitdiff
path: root/src/regexp.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-05-13 18:04:00 +0200
committerBram Moolenaar <Bram@vim.org>2014-05-13 18:04:00 +0200
commit6082bea6acae266c392cd25317414cf3a167a596 (patch)
treeadf727caaa915e6fe1ea0d967e9610ada0e5f121 /src/regexp.c
parent6e13207d82aa925e39eabc0f190c8696481fdf04 (diff)
downloadvim-git-6082bea6acae266c392cd25317414cf3a167a596.tar.gz
updated for version 7.4.292v7.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.
Diffstat (limited to 'src/regexp.c')
-rw-r--r--src/regexp.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/regexp.c b/src/regexp.c
index fe837721e..d66cd2062 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -4692,31 +4692,37 @@ regmatch(scan)
/* match empty string always works; happens when "~" is
* empty. */
}
- else if (opnd[1] == NUL
+ else
+ {
+ if (opnd[1] == NUL
#ifdef FEAT_MBYTE
&& !(enc_utf8 && ireg_ic)
#endif
)
- ++reginput; /* matched a single char */
- else
- {
- len = (int)STRLEN(opnd);
- /* Need to match first byte again for multi-byte. */
- if (cstrncmp(opnd, reginput, &len) != 0)
- status = RA_NOMATCH;
+ {
+ len = 1; /* matched a single byte above */
+ }
+ else
+ {
+ /* Need to match first byte again for multi-byte. */
+ len = (int)STRLEN(opnd);
+ if (cstrncmp(opnd, reginput, &len) != 0)
+ status = RA_NOMATCH;
+ }
#ifdef FEAT_MBYTE
/* Check for following composing character. */
- else if (enc_utf8
- && UTF_COMPOSINGLIKE(reginput, reginput + len))
+ if (status != RA_NOMATCH
+ && enc_utf8
+ && UTF_COMPOSINGLIKE(reginput, reginput + len)
+ && !ireg_icombine)
{
/* raaron: This code makes a composing character get
* ignored, which is the correct behavior (sometimes)
* for voweled Hebrew texts. */
- if (!ireg_icombine)
- status = RA_NOMATCH;
+ status = RA_NOMATCH;
}
#endif
- else
+ if (status != RA_NOMATCH)
reginput += len;
}
}