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.
---
 shortcuts.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/shortcuts.c b/shortcuts.c
index 130f18f..59370e2 100644
--- a/shortcuts.c
+++ b/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;
-- 
1.7.10.4

_______________________________________________
zathura mailing list
zathura@lists.pwmt.org
http://lists.pwmt.org/mailman/listinfo/zathura

Reply via email to