[ncman] don't move down beyond the page

This commit is contained in:
nick black 2021-12-08 01:25:10 -05:00
parent 359af3cf76
commit 41ef5e4790
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -780,6 +780,7 @@ create_bar(struct notcurses* nc, pagedom* dom){
static int
manloop(struct notcurses* nc, const char* arg){
struct ncplane* stdn = notcurses_stdplane(nc);
int ret = -1;
struct ncplane* page = NULL;
struct ncplane* bar = NULL;
@ -823,8 +824,9 @@ manloop(struct notcurses* nc, const char* arg){
}
break;
case 'j': case NCKEY_DOWN:
// FIXME when to stop?
if(ncplane_y(page) + ncplane_dim_y(page) > ncplane_dim_y(stdn)){
ncplane_move_rel(page, -1, 0);
}
break;
case 'q':
ret = 0;