mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-10 21:44:20 +01:00
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:
parent
c06d353eb7
commit
48d12f49be
10
shortcuts.c
10
shortcuts.c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user