From 1304b8cfc8408c005b37c0416013ed2148519cba Mon Sep 17 00:00:00 2001
From: Patrick Steinhardt <ps@pks.im>
Date: Sat, 20 May 2017 17:35:44 +0200
Subject: [PATCH] scroll: fix percent-based scrolling

Scrolling via ^D and ^U should scroll by a percentage of the client's
current viewport. We do this in JavaScript via the client height of the
document's element. Accidentally, it may hold the desired value in some
cases, but in general it only holds the total height of the element
itself. What we desire instead is the window's height, which can be
retrieved via `Window.innerHeight`. Like this, our calculations are not
based upon the webpage but instead on the browser window, fixing
scrolling on some pages.
---
 src/scripts/scroll.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/scripts/scroll.js b/src/scripts/scroll.js
index 92fc481..83e30f8 100644
--- a/src/scripts/scroll.js
+++ b/src/scripts/scroll.js
@@ -2,7 +2,7 @@ function vbscroll(mode, scrollStep, count) {
     var w = window,
         d = document,
         x = y = 0,
-        ph = d.documentElement.clientHeight,
+        ph = w.innerHeight,
         c = count||1,
         rel = true;
     switch (mode) {
-- 
2.20.1