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;
|
return FRAME_EVENT_REFRESH;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum frame_event_status
|
enum frame_event_status
|
||||||
move_search_next(struct session *ses, struct document_view *doc_view)
|
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;
|
x = pt[number].x;
|
||||||
y = pt[number].y;
|
y = pt[number].y;
|
||||||
|
|
||||||
if (x < doc_view->vs->x || x >= doc_view->vs->x + doc_view->box.width)
|
horizontal_scroll_extended(ses, doc_view, x - doc_view->vs->x, 0);
|
||||||
doc_view->vs->x = x;
|
vertical_scroll(ses, doc_view, y - doc_view->vs->y);
|
||||||
doc_view->vs->y = y;
|
|
||||||
set_link(doc_view);
|
|
||||||
|
|
||||||
return FIND_ERROR_NONE;
|
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 */
|
/*! @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)
|
vertical_scroll(struct session *ses, struct document_view *doc_view, int steps)
|
||||||
{
|
{
|
||||||
int y;
|
int y;
|
||||||
@ -335,8 +335,8 @@ vertical_scroll(struct session *ses, struct document_view *doc_view, int steps)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*! @a steps > 0 -> right */
|
/*! @a steps > 0 -> right */
|
||||||
static enum frame_event_status
|
enum frame_event_status
|
||||||
horizontal_scroll(struct session *ses, struct document_view *doc_view, int steps)
|
horizontal_scroll_extended(struct session *ses, struct document_view *doc_view, int steps, int extended)
|
||||||
{
|
{
|
||||||
int x, max;
|
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;
|
x = doc_view->vs->x + steps;
|
||||||
|
|
||||||
if (get_opt_bool("document.browse.scrolling.horizontal_extended", ses)) {
|
if (extended) {
|
||||||
max = doc_view->document->width - 1;
|
max = doc_view->document->width - 1;
|
||||||
} else {
|
} else {
|
||||||
max = int_max(doc_view->vs->x,
|
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;
|
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
|
enum frame_event_status
|
||||||
scroll_up(struct session *ses, struct document_view *doc_view)
|
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_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_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 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_start(struct session *ses, struct document_view *doc_view);
|
||||||
enum frame_event_status move_document_end(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