ref: 67672ffdc9a537ef852c0edd89a5d8cef7346d11
parent: 0596178dd660daaeedeb7eaaea5c0cf27fb49d41
author: Sigrid <[email protected]>
date: Mon Dec 28 07:24:47 EST 2020
plumb: fix wrong click attribute offset (thanks umbraticus)
--- a/sys/src/cmd/plumb/match.c
+++ b/sys/src/cmd/plumb/match.c
@@ -48,13 +48,12 @@
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))