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

Fix refresh after move-page-up with a prefix

Make move_up and move_down return no value. Instead, save the old y value
and compare it to the new after calling move_up or move_down in
move_page_up or move_page_down, respectively.

This fixes a bug where if given a prefix, if that prefix specified a number
of pages greater than move-page-up actually scrolled, there would be no
screen update, because the last call to move_up would return FRAME_EVENT_OK
which would be returned from move_page_up, even tho move_page_up would have
previously returned FRAME_EVENT_REFRESH.
This commit is contained in:
Miciah Dashiel Butler Masters 2006-06-24 07:39:23 +00:00 committed by Miciah Dashiel Butler Masters
parent 888faebaea
commit 76f3dc99b3

View File

@ -80,13 +80,13 @@ detach_formatted(struct document_view *doc_view)
/* type == 0 -> PAGE_DOWN
* type == 1 -> DOWN */
static enum frame_event_status
static void
move_down(struct session *ses, struct document_view *doc_view, int type)
{
int newpos;
assert(ses && doc_view && doc_view->vs);
if_assert_failed return FRAME_EVENT_OK;
if_assert_failed return;
assert(ses->navigate_mode == NAVIGATE_LINKWISE); /* XXX: drop it at some time. --Zas */
@ -95,72 +95,66 @@ move_down(struct session *ses, struct document_view *doc_view, int type)
doc_view->vs->y = newpos;
if (current_link_is_visible(doc_view))
return FRAME_EVENT_REFRESH;
return;
if (type)
find_link_down(doc_view);
else
find_link_page_down(doc_view);
return FRAME_EVENT_REFRESH;
return;
}
enum frame_event_status
move_page_down(struct session *ses, struct document_view *doc_view)
{
enum frame_event_status status;
int oldy = doc_view->vs->y;
int count = eat_kbd_repeat_count(ses);
ses->navigate_mode = NAVIGATE_LINKWISE;
do {
status = move_down(ses, doc_view, 0);
if (status != FRAME_EVENT_REFRESH) break;
} while (--count > 0);
do move_down(ses, doc_view, 0); while (--count > 0);
return status;
return doc_view->vs->y == oldy ? FRAME_EVENT_OK : FRAME_EVENT_REFRESH;
}
/* type == 0 -> PAGE_UP
* type == 1 -> UP */
static enum frame_event_status
static void
move_up(struct session *ses, struct document_view *doc_view, int type)
{
assert(ses && doc_view && doc_view->vs);
if_assert_failed return FRAME_EVENT_OK;
if_assert_failed return;
assert(ses->navigate_mode == NAVIGATE_LINKWISE); /* XXX: drop it at some time. --Zas */
if (doc_view->vs->y == 0) return FRAME_EVENT_OK;
if (doc_view->vs->y == 0) return;
doc_view->vs->y -= doc_view->box.height;
int_lower_bound(&doc_view->vs->y, 0);
if (current_link_is_visible(doc_view))
return FRAME_EVENT_REFRESH;
return;
if (type)
find_link_up(doc_view);
else
find_link_page_up(doc_view);
return FRAME_EVENT_REFRESH;
return;
}
enum frame_event_status
move_page_up(struct session *ses, struct document_view *doc_view)
{
enum frame_event_status status;
int oldy = doc_view->vs->y;
int count = eat_kbd_repeat_count(ses);
ses->navigate_mode = NAVIGATE_LINKWISE;
do {
status = move_up(ses, doc_view, 0);
if (status != FRAME_EVENT_REFRESH) break;
} while (--count > 0);
do move_up(ses, doc_view, 0); while (--count > 0);
return status;
return doc_view->vs->y == oldy ? FRAME_EVENT_OK : FRAME_EVENT_REFRESH;
}
enum frame_event_status