Commit 48d12f49 authored by Benoît Knecht's avatar Benoît Knecht Committed by Sebastian Ramacher

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's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent c06d353e
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment