summaryrefslogtreecommitdiffstats
path: root/Panel.c
diff options
context:
space:
mode:
Diffstat (limited to 'Panel.c')
-rw-r--r--Panel.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Panel.c b/Panel.c
index e8de2b86..d0f69bfd 100644
--- a/Panel.c
+++ b/Panel.c
@@ -250,7 +250,11 @@ void Panel_draw(Panel* this, bool focus) {
int scrollH = this->scrollH;
int y = this->y; int x = this->x;
int first = this->scrollV;
- int last = MIN(itemCount, this->scrollV + MIN(itemCount, this->h));
+ if (itemCount > this->h && first > itemCount - this->h) {
+ first = itemCount - this->h;
+ this->scrollV = first;
+ }
+ int last = MIN(itemCount, first + MIN(itemCount, this->h));
if (this->selected < first) {
first = this->selected;
this->scrollV = first;