~sircmpwn/visurf-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] nsvi: fix duplicated hints

Details
Message ID
<20220301003802.21233-1-ecs@d2evs.net>
DKIM signature
missing
Download raw message
Patch: +8 -0
In some cases, a single href can be propagated to multiple nodes. Search
through previous hints to avoid hinting the same href twice.

Minimal reproduction:

<body>
<a href="foo">bar&amp;baz</a>
---
I tested this and made sure that both gadgets and multiple hints with
the same target still work
 frontends/visurf/commands.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/frontends/visurf/commands.c b/frontends/visurf/commands.c
index 2541d7fbe..6b12e362b 100644
--- a/frontends/visurf/commands.c
+++ b/frontends/visurf/commands.c
@@ -171,6 +171,12 @@ follow_collect_hints(struct gui_window *win, struct box *node, int x, int y)
{
	struct follow_state *follow = &win->follow;
	if ((node->href || node->gadget) && node->width > 0 && node->height > 0) {
		for (size_t i = 0; i < follow->nhint; i++) {
			if (node->href == follow->hints[i].node->href
					&& node->href != NULL) {
				goto end;
			}
		}
		if (!follow->hints) {
			follow->hints = calloc(64, sizeof(struct link_hint));
			follow->nhint = 0;
@@ -188,6 +194,8 @@ follow_collect_hints(struct gui_window *win, struct box *node, int x, int y)
		hint->node = node;
		++follow->nhint;
	}

end:
	for (struct box *child = node->children; child; child = child->next) {
		follow_collect_hints(win, child, x + node->x, y + node->y);
	}
-- 
2.35.1
Details
Message ID
<CIJGB6F91B7C.3AFWH1965O2U2@taiga>
In-Reply-To
<20220301003802.21233-1-ecs@d2evs.net> (view parent)
DKIM signature
missing
Download raw message
Thanks!

To git@git.sr.ht:~sircmpwn/visurf
   14d9df0a4..8f7036e44  master -> master
Reply to thread Export thread (mbox)