vim-patch:7.4.293

Problem:    It is not possible to ignore composing characters at a
            specific point in a pattern.
Solution:   Add the %C item.

https://code.google.com/p/vim/source/detail?r=10fc95f48546f438648b8357062e93c9c2c0a377
This commit is contained in:
Damián Silvani
2014-07-20 13:15:21 -03:00
parent 6d45309797
commit 9ea28e1903
3 changed files with 53 additions and 10 deletions

View File

@@ -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;