[evince] libview: Set minimum for Page Forward/Backward scrolling



commit 809a93e11443627b36155217f191d82aebb2ed6a
Author: Jason Crain <jcrain src gnome org>
Date:   Tue Jul 17 11:10:04 2018 -0500

    libview: Set minimum for Page Forward/Backward scrolling
    
    Page Forward and Backward scrolling leaves a line of context. It jumps
    by the height of the view minus the height of a line of text. But if the
    text is very tall, scrolling may not work or may scroll in the wrong
    direction.
    
    This sets a minimum height for scrolling. If the line is more than 30%
    of the page, the height of the line is ignored and it jumps the full
    view height.
    
    Fixes #692

 libview/ev-view.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index bfe22ea3..6c0e5e71 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -107,6 +107,7 @@ typedef struct {
 #define ZOOM_OUT_FACTOR (1.0/ZOOM_IN_FACTOR)
 
 #define SCROLL_TIME 150
+#define SCROLL_PAGE_THRESHOLD 0.7
 
 #define DEFAULT_PIXBUF_CACHE_SIZE 52428800 /* 50MB */
 
@@ -953,6 +954,10 @@ compute_scroll_increment (EvView        *view,
                if (cairo_region_num_rectangles (sel_region) > 0) {
                        cairo_region_get_rectangle (sel_region, 0, &rect);
                        fraction = 1 - (rect.height / gtk_adjustment_get_page_size (adjustment));
+                       /* jump the full page height if the line is too large a
+                        * fraction of the page */
+                       if (fraction < SCROLL_PAGE_THRESHOLD)
+                               fraction = 1.0;
                }
                cairo_region_destroy (sel_region);
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]