Merge pull request #534 from Explorer09/issue-532

Change scrolling behavior to make it more similar to other applications.
This commit is contained in:
Hisham Muhammad 2016-08-09 13:06:33 -03:00 committed by GitHub
commit b269eb24b0
1 changed files with 3 additions and 2 deletions

View File

@ -407,12 +407,13 @@ bool Panel_onKey(Panel* this, int key) {
break; break;
case KEY_PPAGE: case KEY_PPAGE:
this->selected -= (this->h - 1); this->selected -= (this->h - 1);
this->scrollV -= (this->h - 1); this->scrollV = MAX(0, this->scrollV - this->h + 1);
this->needsRedraw = true; this->needsRedraw = true;
break; break;
case KEY_NPAGE: case KEY_NPAGE:
this->selected += (this->h - 1); 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; this->needsRedraw = true;
break; break;
case KEY_WHEELUP: case KEY_WHEELUP: