summaryrefslogtreecommitdiffstats
path: root/Panel.c
diff options
context:
space:
mode:
authorExplorer09 <explorer09@gmail.com>2016-08-07 07:49:37 +0800
committerExplorer09 <explorer09@gmail.com>2016-08-07 07:49:37 +0800
commit3d9868833e21b8d9f5311fd0321a32f7ce69656c (patch)
treec116f70eda414d6257f5dc912912df0105d0060c /Panel.c
parent3cd03394231e7ced8f68edf31cf56b860c47294d (diff)
Fix scrolling behavior change caused by 759caf0f
Commit "Make PgDown behavior more usual." 759caf0f8fa593430adea676fc64612b5197dca8 silently changes the PageDown scrolling behavior that, instead of scrolling one window down until the end of the window touches the end of the list, the window simply repositions itself in a way that the selected item always become the last item in the new window. The commit reverts the behavior, and also fixes sanity conditionals so that the scrollV variable will _never_ become negative or out-of- bound. Fixes issue #532. Also keep the problem #480 addressed. Signed-off-by: Kang-Che Sung <explorer09 @ gmail.com>
Diffstat (limited to 'Panel.c')
-rw-r--r--Panel.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Panel.c b/Panel.c
index 579a82cc..8c4d44fc 100644
--- a/Panel.c
+++ b/Panel.c
@@ -407,12 +407,13 @@ bool Panel_onKey(Panel* this, int key) {
break;
case KEY_PPAGE:
this->selected -= (this->h - 1);
- this->scrollV -= (this->h - 1);
+ this->scrollV = MAX(0, this->scrollV - this->h + 1);
this->needsRedraw = true;
break;
case KEY_NPAGE:
this->selected += (this->h - 1);
- this->scrollV = MIN(MAX(0, Vector_size(this->items) - this->h), this->selected - this->h);
+ this->scrollV = MAX(0, MIN(Vector_size(this->items) - this->h,
+ this->scrollV + this->h - 1));
this->needsRedraw = true;
break;
case KEY_WHEELUP:

© 2014-2024 Faster IT GmbH | imprint | privacy policy