git: 9front

Download patch

ref: 58a5c05667c766eba3269a1226bca63e7094a22e
parent: 81a96200ffac1a029f0348b5f2da56103f09cbe6
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Wed Sep 26 14:28:10 EDT 2012

mothra: dont make all images into links (only in mothmode)

--- a/sys/src/cmd/mothra/mothra.c
+++ b/sys/src/cmd/mothra/mothra.c
@@ -718,17 +718,19 @@
 	Action *a;
 
 	a=word->user;
-	if(a == nil || a->image == nil && a->link == nil)
+	if(a == nil || (a->link == nil && a->image == nil))
 		return;
 	if(mothmode)
 		hiturl(buttons, a->image ? a->image : a->link, 0);
-	else if(a->ismap){
-		yoffs=plgetpostextview(p);
-		coord=subpt(subpt(mouse.xy, word->r.min), p->r.min);
-		snprint(mapurl, sizeof(mapurl), "%s?%d,%d", a->link, coord.x, coord.y+yoffs);
-		hiturl(buttons, mapurl, 1);
-	} else
-		hiturl(buttons, a->link ? a->link : a->image, 0);
+	else if(a->link){
+		if(a->ismap){
+			yoffs=plgetpostextview(p);
+			coord=subpt(subpt(mouse.xy, word->r.min), p->r.min);
+			snprint(mapurl, sizeof(mapurl), "%s?%d,%d", a->link, coord.x, coord.y+yoffs);
+			hiturl(buttons, mapurl, 1);
+		} else
+			hiturl(buttons, a->link, 0);
+	}
 }
 
 void filter(char *cmd, int fd){
@@ -982,8 +984,15 @@
 	 */
 	for(t=w->text;t;t=t->next){
 		a=t->user;
-		if(a == nil || a->image == nil || a->link == nil)
+		if(a == nil || a->image == nil)
 			continue;
+		if(a->link == nil){
+			if(on)
+				t->flags |= PL_HOT;
+			else
+				t->flags &= ~PL_HOT;
+			continue;
+		}
 		x = t->next;
 		if(on){
 			t->next = nil;
--- a/sys/src/cmd/mothra/rdhtml.c
+++ b/sys/src/cmd/mothra/rdhtml.c
@@ -144,7 +144,7 @@
 		}
 	}
 	plrtstr(&g->dst->text, space, indent, f->font, strdup(s),
-		(g->state->link[0] || g->state->image[0]) ? PL_HOT : 0, ap);
+		g->state->link[0] ? PL_HOT : 0, ap);
 	g->para=0;
 	g->linebrk=0;
 	g->dst->changed=1;
--