tmot: the number of matched utf-8 characters as length in lbuf_search() - neatv… | |
git clone git://src.adamsgaard.dk/neatvi | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 174014fe69371a038454126b0b1b7fcc1d077540 | |
parent 6ec8f20a4a15db6ec888b4815d9b7eb426515dfa | |
Author: Ali Gholami Rudi <[email protected]> | |
Date: Mon, 15 Jun 2015 18:54:22 +0430 | |
mot: the number of matched utf-8 characters as length in lbuf_search() | |
Diffstat: | |
M mot.c | 4 ++-- | |
1 file changed, 2 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/mot.c b/mot.c | |
t@@ -63,12 +63,12 @@ int lbuf_search(struct lbuf *lb, char *kw, int dir, int *r… | |
int off = dir > 0 && r0 == i ? uc_chr(s, o0 + 1) - s : 0; | |
int flg = off ? RE_NOTBOL : 0; | |
while (rset_find(re, s + off, 1, offs, flg) >= 0) { | |
- if (dir < 0 && r0 == i && off + offs[0] >= o0) | |
+ if (dir < 0 && r0 == i && uc_off(s, off + offs[0]) >= … | |
break; | |
found = 1; | |
*o = uc_off(s, off + offs[0]); | |
*r = i; | |
- *len = offs[1] - offs[0]; | |
+ *len = uc_off(s + off + offs[0], offs[1] - offs[0]); | |
off += offs[1]; | |
if (dir > 0) | |
break; |