aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r--src/nvim/regexp.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index ba7e4eb2d3..193c68860d 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -258,6 +258,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.
@@ -2024,6 +2025,10 @@ static char_u *regatom(int *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 '[':
@@ -4099,10 +4104,12 @@ regmatch (
status = RA_NOMATCH;
}
}
- // 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)
// for voweled Hebrew texts.
@@ -4167,6 +4174,15 @@ regmatch (
status = RA_NOMATCH;
break;
+ case RE_COMPOSING:
+ if (enc_utf8) {
+ // Skip composing characters.
+ while (utf_iscomposing(utf_ptr2char(reginput))) {
+ mb_cptr_adv(reginput);
+ }
+ }
+ break;
+
case NOTHING:
break;