hej,

just wrote two new scrolling features, and would enjoy it very much, if
they were committed to upstream.

i like to read documents pagewise. and think it is easier not to loose
the line, when there is a slight overlap between the two views before
and after scrolling.

the patch introduces a new setting scroll-full-overlap which defaults to
0.1, i.e. a full scroll keeps 10% of the view visible or equivalently
scrolls by 0.9 * view_size.

tested on current archlinux.

just mail me if you require me to adapt/change anything.

cheers,
jonas

>From a19307911405f3f2c54b867a6c4af8ce30870e7a Mon Sep 17 00:00:00 2001
From: Jonas Hoersch <[email protected]>
Date: Sat, 15 Sep 2012 13:33:41 +0200
Subject: [PATCH 1/2] Add full page scroll overlap setting

The default of 0.1 keeps 10% of a page visible on a full-page scroll.
---
 config.c    | 2 ++
 shortcuts.c | 7 +++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/config.c b/config.c
index 9f51025..2687b9d 100644
--- a/config.c
+++ b/config.c
@@ -145,6 +145,8 @@ config_load_default(zathura_t* zathura)
   girara_setting_add(gsession, "scroll-step",           &float_value, FLOAT,  false, _("Scroll step"),             NULL, NULL);
   float_value = -1;
   girara_setting_add(gsession, "scroll-hstep",          &float_value, FLOAT,  false, _("Horizontal scroll step"),             NULL, NULL);
+  float_value = 0.1;
+  girara_setting_add(gsession, "scroll-full-overlap",   &float_value, FLOAT,  false, _("Full page scroll overlap"),           NULL, NULL);
   int_value = 10;
   girara_setting_add(gsession, "zoom-min",              &int_value,   INT,    false, _("Zoom minimum"), NULL, NULL);
   int_value = 1000;
diff --git a/shortcuts.c b/shortcuts.c
index 1f90f7a..bbb34b0 100644
--- a/shortcuts.c
+++ b/shortcuts.c
@@ -563,6 +563,9 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
   if (scroll_hstep < 0) {
     scroll_hstep = scroll_step;
   }
+  float scroll_full_overlap = 0.1;
+  girara_setting_get(session, "scroll-full-overlap", &scroll_full_overlap);
+
   int padding = 1;
   girara_setting_get(session, "page-padding", &padding);
 
@@ -571,11 +574,11 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
   switch(argument->n) {
     case FULL_UP:
     case FULL_LEFT:
-      new_value = value - view_size - padding;
+      new_value = value - (1.0 - scroll_full_overlap) * view_size - padding;
       break;
     case FULL_DOWN:
     case FULL_RIGHT:
-      new_value = value + view_size + padding;
+      new_value = value + (1.0 - scroll_full_overlap) * view_size + padding;
       break;
     case HALF_UP:
     case HALF_LEFT:
-- 
1.7.12

_______________________________________________
zathura mailing list
[email protected]
http://lists.pwmt.org/mailman/listinfo/zathura

Reply via email to