9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] plumber bug when matching with click attribute
@ 2020-12-28 10:20 umbraticus
  0 siblings, 0 replies; only message in thread
From: umbraticus @ 2020-12-28 10:20 UTC (permalink / raw)
  To: 9front

In spite of the comment in the source, plumber was not calculating
the offset of a click attribute into the string correctly.

umbraticus

diff -r 54bd41c74f5f sys/src/cmd/plumb/match.c
--- a/sys/src/cmd/plumb/match.c	Sun Dec 27 23:39:28 2020 +0100
+++ b/sys/src/cmd/plumb/match.c	Mon Dec 28 23:12:21 2020 +1300
@@ -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))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-28 10:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-28 10:20 [9front] plumber bug when matching with click attribute umbraticus

9front - general discussion about 9front

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/9front

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 9front 9front/ http://inbox.vuxu.org/9front \
		9front@9front.org
	public-inbox-index 9front

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.9front


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git