[elinks-dev] Sponsor development of the key motion.

Witold Filipczyk witekfl at poczta.onet.pl
Tue Aug 14 11:59:14 MDT 2007


Here is the patch.
Kalle, Jonas, could apply them (key motion patches) to the mainstream ELinks?
-------------- next part --------------
move-link-down-line, move-link-prev-line, etc.:
Change mode to NAVIGATE_LINKWISE to preserve the link position when
going back.

---
commit 14b37d0362f9963cb2803d08d2c3e6e84574cdbe
tree 062545598ae45bf519f7e825b0302542061bbf34
parent 2045574edca170a47b1e9f1e05cd210bdae8a49a
author Witold Filipczyk <witekfl at poczta.onet.pl> Tue, 14 Aug 2007 19:56:02 +0200
committer Witold Filipczyk <nobody at nowhere> Tue, 14 Aug 2007 19:56:02 +0200

 src/viewer/text/view.c |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/viewer/text/view.c b/src/viewer/text/view.c
index 887f301..a0ebefa 100644
--- a/src/viewer/text/view.c
+++ b/src/viewer/text/view.c
@@ -201,8 +201,13 @@ move_link_prev_line(struct session *ses, struct document_view *doc_view)
 			if (!last) last = link;
 			else if (link->points[0].x > last->points[0].x) last = link;
 		}
-		if (last)
-			return move_cursor_rel(ses, doc_view, last->points[0].x - x1, last->points[0].y - y1);
+		if (last) {
+			enum frame_event_status status = move_cursor_rel(ses, doc_view,
+				last->points[0].x - x1, last->points[0].y - y1);
+
+			ses->navigate_mode = NAVIGATE_LINKWISE;
+			return status;
+		}
 	}
 	return FRAME_EVENT_OK;
 }
@@ -245,8 +250,13 @@ move_link_next_line(struct session *ses, struct document_view *doc_view)
 			if (!last) last = link;
 			else if (link->points[0].x < last->points[0].x) last = link;
 		}
-		if (last)
-			return move_cursor_rel(ses, doc_view, last->points[0].x - x1, last->points[0].y - y1);
+		if (last) {
+			enum frame_event_status status = move_cursor_rel(ses, doc_view,
+				last->points[0].x - x1, last->points[0].y - y1);
+
+			ses->navigate_mode = NAVIGATE_LINKWISE;
+			return status;
+		}
 	}
 	return FRAME_EVENT_OK;
 }
@@ -708,7 +718,12 @@ move_link_vertical(struct session *ses, struct document_view *doc_view, int dir_
 		if (!link) continue;
 		for (; link <= document->lines2[y]; link++) {
 			if (link->points[0].y == y) {
-				return move_cursor_rel(ses, doc_view, 0, y - y1);
+				enum frame_event_status status = move_cursor_rel(ses,
+					doc_view, 0, y - y1);
+
+				if (vs->current_link != -1)
+					ses->navigate_mode = NAVIGATE_LINKWISE;
+				return status;
 			}
 		}
 	}


More information about the elinks-dev mailing list