summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/regexp.c35
-rw-r--r--src/version.c2
2 files changed, 33 insertions, 4 deletions
diff --git a/src/regexp.c b/src/regexp.c
index d66cd206..dcb9a3b4 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -244,6 +244,7 @@
#define RE_MARK 207 /* mark cmp Match mark position */
#define RE_VISUAL 208 /* Match Visual area */
+#define RE_COMPOSING 209 /* any composing characters */
/*
* Magic characters have a special meaning, they don't match literally.
@@ -2208,6 +2209,10 @@ regatom(flagp)
ret = regnode(RE_VISUAL);
break;
+ case 'C':
+ ret = regnode(RE_COMPOSING);
+ break;
+
/* \%[abc]: Emit as a list of branches, all ending at the last
* branch which matches nothing. */
case '[':
@@ -3104,15 +3109,25 @@ peekchr()
if (reg_magic >= MAGIC_OFF)
{
char_u *p = regparse + 1;
+ int is_magic_all = (reg_magic == MAGIC_ALL);
- /* ignore \c \C \m and \M after '$' */
+ /* ignore \c \C \m \M \v \V and \Z after '$' */
while (p[0] == '\\' && (p[1] == 'c' || p[1] == 'C'
- || p[1] == 'm' || p[1] == 'M' || p[1] == 'Z'))
+ || p[1] == 'm' || p[1] == 'M'
+ || p[1] == 'v' || p[1] == 'V' || p[1] == 'Z'))
+ {
+ if (p[1] == 'v')
+ is_magic_all = TRUE;
+ else if (p[1] == 'm' || p[1] == 'M' || p[1] == 'V')
+ is_magic_all = FALSE;
p += 2;
+ }
if (p[0] == NUL
|| (p[0] == '\\'
&& (p[1] == '|' || p[1] == '&' || p[1] == ')'
|| p[1] == 'n'))
+ || (is_magic_all
+ && (p[0] == '|' || p[0] == '&' || p[0] == ')'))
|| reg_magic == MAGIC_ALL)
curchr = Magic('$');
}
@@ -4710,11 +4725,13 @@ regmatch(scan)
status = RA_NOMATCH;
}
#ifdef FEAT_MBYTE
- /* Check for following composing character. */
+ /* Check for following composing character, unless %C
+ * follows (skips over all composing chars). */
if (status != RA_NOMATCH
&& enc_utf8
&& UTF_COMPOSINGLIKE(reginput, reginput + len)
- && !ireg_icombine)
+ && !ireg_icombine
+ && OP(next) != RE_COMPOSING)
{
/* raaron: This code makes a composing character get
* ignored, which is the correct behavior (sometimes)
@@ -4791,6 +4808,16 @@ regmatch(scan)
status = RA_NOMATCH;
break;
#endif
+ case RE_COMPOSING:
+#ifdef FEAT_MBYTE
+ if (enc_utf8)
+ {
+ /* Skip composing characters. */
+ while (utf_iscomposing(utf_ptr2char(reginput)))
+ mb_cptr_adv(reginput);
+ }
+#endif
+ break;
case NOTHING:
break;
diff --git a/src/version.c b/src/version.c
index faaaf76a..9867e7f0 100644
--- a/src/version.c
+++ b/src/version.c
@@ -735,6 +735,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 360,
+/**/
359,
/**/
358,