mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Reuse existing functions to scroll. Added horizontal_scroll_extended.
This commit is contained in:
parent
7a006b6dd2
commit
798a7cc4e6
@ -1312,6 +1312,7 @@ move_search_do(struct session *ses, struct document_view *doc_view, int directio
|
||||
|
||||
return FRAME_EVENT_REFRESH;
|
||||
}
|
||||
|
||||
enum frame_event_status
|
||||
move_search_next(struct session *ses, struct document_view *doc_view)
|
||||
{
|
||||
@ -1340,10 +1341,8 @@ move_search_number(struct session *ses, struct document_view *doc_view, int numb
|
||||
x = pt[number].x;
|
||||
y = pt[number].y;
|
||||
|
||||
if (x < doc_view->vs->x || x >= doc_view->vs->x + doc_view->box.width)
|
||||
doc_view->vs->x = x;
|
||||
doc_view->vs->y = y;
|
||||
set_link(doc_view);
|
||||
horizontal_scroll_extended(ses, doc_view, x - doc_view->vs->x, 0);
|
||||
vertical_scroll(ses, doc_view, y - doc_view->vs->y);
|
||||
|
||||
return FIND_ERROR_NONE;
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ move_link_dir(struct session *ses, struct document_view *doc_view, int dir_x, in
|
||||
}
|
||||
|
||||
/*! @a steps > 0 -> down */
|
||||
static enum frame_event_status
|
||||
enum frame_event_status
|
||||
vertical_scroll(struct session *ses, struct document_view *doc_view, int steps)
|
||||
{
|
||||
int y;
|
||||
@ -335,8 +335,8 @@ vertical_scroll(struct session *ses, struct document_view *doc_view, int steps)
|
||||
}
|
||||
|
||||
/*! @a steps > 0 -> right */
|
||||
static enum frame_event_status
|
||||
horizontal_scroll(struct session *ses, struct document_view *doc_view, int steps)
|
||||
enum frame_event_status
|
||||
horizontal_scroll_extended(struct session *ses, struct document_view *doc_view, int steps, int extended)
|
||||
{
|
||||
int x, max;
|
||||
|
||||
@ -345,7 +345,7 @@ horizontal_scroll(struct session *ses, struct document_view *doc_view, int steps
|
||||
|
||||
x = doc_view->vs->x + steps;
|
||||
|
||||
if (get_opt_bool("document.browse.scrolling.horizontal_extended", ses)) {
|
||||
if (extended) {
|
||||
max = doc_view->document->width - 1;
|
||||
} else {
|
||||
max = int_max(doc_view->vs->x,
|
||||
@ -365,6 +365,17 @@ horizontal_scroll(struct session *ses, struct document_view *doc_view, int steps
|
||||
return FRAME_EVENT_REFRESH;
|
||||
}
|
||||
|
||||
/*! @a steps > 0 -> right */
|
||||
static enum frame_event_status
|
||||
horizontal_scroll(struct session *ses, struct document_view *doc_view, int steps)
|
||||
{
|
||||
assert(ses && doc_view && doc_view->vs && doc_view->document);
|
||||
if_assert_failed return FRAME_EVENT_OK;
|
||||
|
||||
return horizontal_scroll_extended(ses, doc_view, steps,
|
||||
get_opt_bool("document.browse.scrolling.horizontal_extended", ses));
|
||||
}
|
||||
|
||||
enum frame_event_status
|
||||
scroll_up(struct session *ses, struct document_view *doc_view)
|
||||
{
|
||||
|
@ -42,6 +42,8 @@ enum frame_event_status scroll_up(struct session *ses, struct document_view *doc
|
||||
enum frame_event_status scroll_down(struct session *ses, struct document_view *doc_view);
|
||||
enum frame_event_status scroll_left(struct session *ses, struct document_view *doc_view);
|
||||
enum frame_event_status scroll_right(struct session *ses, struct document_view *doc_view);
|
||||
enum frame_event_status horizontal_scroll_extended(struct session *ses, struct document_view *doc_view, int steps, int extended);
|
||||
enum frame_event_status vertical_scroll(struct session *ses, struct document_view *doc_view, int steps);
|
||||
|
||||
enum frame_event_status move_document_start(struct session *ses, struct document_view *doc_view);
|
||||
enum frame_event_status move_document_end(struct session *ses, struct document_view *doc_view);
|
||||
|
Loading…
Reference in New Issue
Block a user