tregex: match patterns at utf-8 character beginnings - neatvi - [fork] simple v… | |
git clone git://src.adamsgaard.dk/neatvi | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 979fba724b1590629fd7a6d45abdf68cc4f61490 | |
parent a7499618cabdde63d86afcb674bbca6f452cd540 | |
Author: Ali Gholami Rudi <[email protected]> | |
Date: Mon, 23 May 2016 14:33:29 +0430 | |
regex: match patterns at utf-8 character beginnings | |
Diffstat: | |
M regex.c | 7 ++----- | |
1 file changed, 2 insertions(+), 5 deletions(-) | |
--- | |
diff --git a/regex.c b/regex.c | |
t@@ -104,10 +104,6 @@ static int uc_len(char *s) | |
return 3; | |
if (~c & 0x08) | |
return 4; | |
- if (~c & 0x04) | |
- return 5; | |
- if (~c & 0x02) | |
- return 6; | |
return 1; | |
} | |
t@@ -587,7 +583,8 @@ int regexec(regex_t *preg, char *s, int nsub, regmatch_t p… | |
rs.flg = re->flg | flg; | |
rs.o = s; | |
while (*s) { | |
- rs.s = s++; | |
+ rs.s = s; | |
+ s += uc_len(s); | |
if (!re_recmatch(re, &rs, flg & REG_NOSUB ? 0 : nsub, psub)) | |
return 0; | |
} |