Re: Sponsor development of the key motion.
Jonas Fonseca <[email protected]>
| Newsgroups | gmane.comp.web.links |
|---|---|
| Message-ID | <[email protected]> |
Ligesh <[email protected]> wrote Fri, Aug 10, 2007: > > Hi, > > I had requested a specific 2 dimensional keyboard motion some time back. It was like this: the up/down arrows will move straight up and down, and will stop on a line that contains a link anywhere on that line. The up/down arrows will not move right/left at all. They will just stop on a line which contains the link anywhere, even if the exact location of the cursor does not have a link. This should be something like the move-cursor-* actions, right? Try putting this in your elinks.conf and test: bind "main" "up" = "move-cursor-up" bind "main" "down" = "move-cursor-down" > The right-left would of course move along the links on a single line. The right-left would also wrap-around, so that after the farthest right link, the right button will wrap to the left most link on the left line. But up/down moves only straight. bind "main" "right" = "move-link-right" bind "main" "left" = "move-link-left" Almost does what, I think, you want. Unfortunately, it jumps to a random link sometimes. I've never used this feature and the code is a bit "hairy". > I would like to know if I can sponsor this feature. Maybe you could test the patch below, which makes the horizontal navigation "kind-of" work when browsing local directories and could serve as a start. diff --git a/src/viewer/text/link.c b/src/viewer/text/link.c index 175a0ff..715e690 100644 --- a/src/viewer/text/link.c +++ b/src/viewer/text/link.c @@ -615,14 +615,17 @@ next_link_in_dir(struct document_view *doc_view, int dir_x, int dir_y) vs = doc_view->vs; link = get_current_link(doc_view); - if (!link) return 0; + if (link) { + /* Find the link's "bounding box" coordinates. */ - /* Find the link's "bounding box" coordinates. */ + get_link_x_bounds(link, -1, &min_x, &max_x); - get_link_x_bounds(link, -1, &min_x, &max_x); - - min_y = link->points[0].y; - max_y = link->points[link->npoints - 1].y; + min_y = link->points[0].y; + max_y = link->points[link->npoints - 1].y; + } else { + min_x = max_x = doc_view->session->tab->x - doc_view->box.x; + min_y = max_y = doc_view->session->tab->y - doc_view->box.y; + } /* Now go from the bounding box edge in the appropriate * direction and find the nearest link. */ -- Jonas Fonseca