From 42d809a5410264783ed3af86e7709b237393b5f7 Mon Sep 17 00:00:00 2001
From: echicken <>
Date: Mon, 14 Oct 2019 16:58:33 +0000
Subject: [PATCH] Improved end / page up / page down

---
 exec/load/scrollbox.js | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/exec/load/scrollbox.js b/exec/load/scrollbox.js
index 90e00844a7..65d8468302 100644
--- a/exec/load/scrollbox.js
+++ b/exec/load/scrollbox.js
@@ -177,19 +177,18 @@ ScrollBox.prototype.getcmd = function (c) {
         return true;
     }
     if (c == KEY_END) {
-        this.scroll_into_view(this.wrap_map.length - 1);
+        this.y = this._text.length - 1 - this.height;
+        this._load();
         return true;
     }
     if (c == KEY_PAGEUP) {
-        this.scroll_to(Math.max(0, this.y - this.height - 1));
+        this.y = Math.max(0, this.y - this.height);
+        this._load();
         return true;
     }
     if (c == KEY_PAGEDN) {
-        if (this.y + this.height + 1 >= this.wrap_map.length - 1) {
-            this.scroll_into_view(this.wrap_map.length - 1);
-        } else {
-            this.scroll_to(this.y + this.height + 1);
-        }
+        this.y = Math.min(this._text.length - 1 - this.height, this.y + this.height);
+        this._load();
         return true;
     }
 }
-- 
GitLab