1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

move-link-down-line, move-link-prev-line, etc.:

Change mode to NAVIGATE_LINKWISE to preserve the link position when
going back.
This commit is contained in:
Witold Filipczyk 2007-08-14 19:56:02 +02:00 committed by Witold Filipczyk
parent 2045574edc
commit 14b37d0362

View File

@ -201,8 +201,13 @@ move_link_prev_line(struct session *ses, struct document_view *doc_view)
if (!last) last = link; if (!last) last = link;
else if (link->points[0].x > last->points[0].x) last = link; else if (link->points[0].x > last->points[0].x) last = link;
} }
if (last) if (last) {
return move_cursor_rel(ses, doc_view, last->points[0].x - x1, last->points[0].y - y1); 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; return FRAME_EVENT_OK;
} }
@ -245,8 +250,13 @@ move_link_next_line(struct session *ses, struct document_view *doc_view)
if (!last) last = link; if (!last) last = link;
else if (link->points[0].x < last->points[0].x) last = link; else if (link->points[0].x < last->points[0].x) last = link;
} }
if (last) if (last) {
return move_cursor_rel(ses, doc_view, last->points[0].x - x1, last->points[0].y - y1); 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; return FRAME_EVENT_OK;
} }
@ -708,7 +718,12 @@ move_link_vertical(struct session *ses, struct document_view *doc_view, int dir_
if (!link) continue; if (!link) continue;
for (; link <= document->lines2[y]; link++) { for (; link <= document->lines2[y]; link++) {
if (link->points[0].y == y) { 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;
} }
} }
} }