plumb: fix wrong click attribute offset (thanks umbraticus)

This commit is contained in:
Sigrid 2020-12-28 12:24:47 +01:00
parent 0596178dd6
commit 67672ffdc9

View file

@ -48,13 +48,12 @@ int
clickmatch(Reprog *re, char *text, Resub rs[10], int click)
{
char *clickp;
int i, w;
int i;
Rune r;
/* click is in characters, not bytes */
for(i=0; i<click && text[i]!='\0'; i+=w)
w = chartorune(&r, text+i);
clickp = text+i;
for(i=0, clickp=text; i<click && *clickp!='\0'; i++)
clickp += chartorune(&r, clickp);
for(i=0; i<=click; i++){
memset(rs, 0, 10*sizeof(Resub));
if(regexec(re, text+i, rs, 10))