diff --git a/src/document/view.h b/src/document/view.h index dde0303e..cb514ab7 100644 --- a/src/document/view.h +++ b/src/document/view.h @@ -23,6 +23,7 @@ struct document_view { int last_x, last_y; /**< last pos of window */ int depth; int used; + int prev_y; }; #define get_old_current_link(doc_view) \ diff --git a/src/viewer/text/draw.c b/src/viewer/text/draw.c index 749a7828..a38a0426 100644 --- a/src/viewer/text/draw.c +++ b/src/viewer/text/draw.c @@ -248,7 +248,6 @@ draw_doc(struct session *ses, struct document_view *doc_view, int active) if (ses->navigate_mode == NAVIGATE_LINKWISE) { check_vs(doc_view); - } else { check_link_under_cursor(ses, doc_view); } @@ -261,6 +260,22 @@ draw_doc(struct session *ses, struct document_view *doc_view, int active) doc_view->vs->y = vy; set_link(doc_view); } + if (vy == -1) { + struct location *loc = cur_loc(ses); + + if (loc) { + struct uri *cur_uri = loc->vs.uri; + + if (list_has_prev(ses->history.history, loc)) { + struct uri *prev_uri = loc->prev->vs.uri; + + if (compare_uri(cur_uri, prev_uri, URI_BASE)) { + doc_view->vs->y = doc_view->prev_y; + set_link(doc_view); + } + } + } + } } vx = vs->x; vy = vs->y; diff --git a/src/viewer/text/link.c b/src/viewer/text/link.c index bb606abd..1b3354ee 100644 --- a/src/viewer/text/link.c +++ b/src/viewer/text/link.c @@ -969,6 +969,12 @@ goto_link(struct session *ses, struct document_view *doc_view, struct link *link assert(link && doc_view && ses); if_assert_failed return NULL; + if (doc_view->vs) { + doc_view->prev_y = doc_view->vs->y; + } else { + doc_view->prev_y = 0; + } + if (link_is_form(link)) { struct el_form_control *fc = link->data.form_control;