This patch fixes the following issue: 

When pressing 'a' or 's' while there are more than one page per row, the 
resultant new scale value is greater than what it's supposed to be, due to not 
taking the paddings into account when calculating it. This is apparent, when 
scrolling horizontally after scaling and noticing that the grid could still be 
scrolled a little bit to the left and right. If the show-scrollbars setting is 
set to true, this will cause the horizontal scrollbar to always be shown after 
scaling using 's', or 'a' given enough pages per row.

---
 shortcuts.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/shortcuts.c b/shortcuts.c
index 9a33d22..44b790f 100644
--- a/shortcuts.c
+++ b/shortcuts.c
@@ -144,7 +144,7 @@ sc_adjust_window(girara_session_t* session, 
girara_argument_t* argument,
   if (argument->n == ZATHURA_ADJUST_WIDTH ||
       (argument->n == ZATHURA_ADJUST_BESTFIT && page_ratio < window_ratio)) {
     scale = (double)(width - (pages_per_row - 1) * padding) /
-            (double)(pages_per_row * cell_width);
+            (double)(pages_per_row * cell_width + (pages_per_row - 1) * 
padding);
     zathura_document_set_scale(zathura->document, scale);
 
     bool show_scrollbars = false;
@@ -165,7 +165,7 @@ sc_adjust_window(girara_session_t* session, 
girara_argument_t* argument,
           if (0 < requisition.width && (unsigned)requisition.width < width) {
             width -= requisition.width;
             scale = (double)(width - (pages_per_row - 1) * padding) /
-                    (double)(pages_per_row * cell_width);
+                    (double)(pages_per_row * cell_width + (pages_per_row - 1) 
* padding);
             zathura_document_set_scale(zathura->document, scale);
           }
         }
-- 
1.7.10.4

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

Reply via email to