From 175f355320bb3b6b2565869325abaea0900398b2 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 19 Aug 2007 20:46:32 +0200 Subject: [PATCH] move-link-prev-line: Really fixed. (cherry picked from commit 052f7a93bb4548b858bf8832a87a595f9d630b48) (cherry picked from commit 1a9112945b273e562474e13c5bd6dba572cf58e4) --- src/viewer/text/view.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/viewer/text/view.c b/src/viewer/text/view.c index 4d886015..7378a6e7 100644 --- a/src/viewer/text/view.c +++ b/src/viewer/text/view.c @@ -708,9 +708,15 @@ move_link_prev_line(struct session *ses, struct document_view *doc_view) vs = doc_view->vs; document = doc_view->document; - if (!document->lines1) return FRAME_EVENT_OK; box = &doc_view->box; - + if (!document->lines1) { + if (vs->y) { + vs->y -= box->height; + int_lower_bound(&vs->y, 0); + return FRAME_EVENT_REFRESH; + } + return FRAME_EVENT_OK; + } y = y1 = vs->y + ses->tab->y - box->y; x1 = vs->x + ses->tab->x - box->x; @@ -721,7 +727,7 @@ move_link_prev_line(struct session *ses, struct document_view *doc_view) min_x = max_x = x1; } int_upper_bound(&y, document->height - 1); - min_y = int_min(0, vs->y - box->height); + min_y = int_max(0, vs->y - box->height); for (; y >= min_y; y--, min_x = INT_MAX) { link = document->lines1[y]; @@ -770,9 +776,14 @@ move_link_next_line(struct session *ses, struct document_view *doc_view) vs = doc_view->vs; document = doc_view->document; - if (!document->lines1) return FRAME_EVENT_OK; box = &doc_view->box; - + if (!document->lines1) { + if (vs->y + box->height < document->height) { + vs->y += box->height; + return FRAME_EVENT_REFRESH; + } + return FRAME_EVENT_OK; + } y = y1 = vs->y + ses->tab->y - box->y; x1 = vs->x + ses->tab->x - box->x;