ncselector: implement pgup/pgdown #862

This commit is contained in:
nick black 2020-08-16 05:50:18 -04:00
parent 046d4a9d5d
commit 02fb9b078f
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -436,6 +436,7 @@ const char* ncselector_nextitem(ncselector* n){
}
bool ncselector_offer_input(ncselector* n, const ncinput* nc){
const int items_shown = ncplane_dim_y(n->ncp) - 4 - (n->title ? 2 : 0);
if(nc->id == NCKEY_UP){
ncselector_previtem(n);
return true;
@ -449,10 +450,18 @@ bool ncselector_offer_input(ncselector* n, const ncinput* nc){
ncselector_nextitem(n);
return true;
}else if(nc->id == NCKEY_PGDOWN){
ncselector_nextitem(n); // FIXME should be a page's worth, or go to bottom
if(items_shown > 0){
for(int i = 0 ; i < items_shown ; ++i){
ncselector_nextitem(n);
}
}
return true;
}else if(nc->id == NCKEY_PGUP){
ncselector_previtem(n); // FIXME should be a page's worth, or go to top
if(items_shown > 0){
for(int i = 0 ; i < items_shown ; ++i){
ncselector_previtem(n);
}
}
return true;
}else if(nc->id == NCKEY_RELEASE){
int y = nc->y, x = nc->x;