Also wrap when scrolling with 'j' and 'k'

The scroll-wrap option used to only change the behavior of 'J' and 'K'
(i.e.  moving one page forward/backward).

Now, if scroll-wrap is true and the top of the first page is shown,
pressing 'k' will show the bottom of the last page; conversely, when at
the bottom of the last page, pressing 'j' will show the top of the first
page.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Benoît Knecht 2012-12-06 10:57:05 +01:00 committed by Sebastian Ramacher
parent c06d353eb7
commit 48d12f49be

View File

@ -567,6 +567,9 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
bool scroll_page_aware = false;
girara_setting_get(session, "scroll-page-aware", &scroll_page_aware);
bool scroll_wrap = false;
girara_setting_get(session, "scroll-wrap", &scroll_wrap);
int padding = 1;
girara_setting_get(session, "page-padding", &padding);
@ -611,6 +614,13 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
new_value = value;
}
if (scroll_wrap == true) {
if (new_value < 0)
new_value = max;
else if (new_value > max)
new_value = 0;
}
if (scroll_page_aware == true) {
int page_offset;
double page_size;