Skip to content
Snippets Groups Projects
Commit d7f08b2e authored by deuce's avatar deuce
Browse files

Support PageUP/PageDOWN in ulist()

parent 3069fcb0
No related branches found
No related tags found
No related merge requests found
...@@ -787,37 +787,58 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar ...@@ -787,37 +787,58 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
,s_left+left+width-2,s_top+y,line); ,s_left+left+width-2,s_top+y,line);
} }
break; break;
#if 0 case KEY_PPAGE: /* PgUp */
case KEY_PPAGE; /* PgUp */ if(!opts)
case KEY_NPAGE; /* PgDn */
if(!opts || (*cur)==(opts-1))
break; break;
(*cur)+=(height-4); *cur -= (height-5);
if((*cur)>(opts-1)) if(*cur<0)
(*cur)=(opts-1); *cur = 0;
if(bar)
gettext(s_left+3+left,s_top+y *bar=0;
,s_left+left+width-2,s_top+y,line); y=s_top+top;
for(i=1;i<width*2;i+=2) gotoxy(s_left+left+1,s_top+top+3);
line[i]=lclr|(bclr<<4); textattr(lclr|(bclr<<4));
puttext(s_left+3+left,s_top+y if(*cur && opts>height-3) /* Scroll mode */
,s_left+left+width-2,s_top+y,line); putch(30); /* put the up arrow */
else
for(i=(opts+4)-height,j=0;i<opts;i++,j++) putch(' '); /* delete the up arrow */
gotoxy(s_left+left+1,s_top+top+height-2);
if(opts > height-3 && *cur + height - 4 < opts)
putch(31); /* put the down arrow */
else
putch(' '); /* delete the down arrow */
for(i=*cur,j=0;i<=*cur-5+height;i++,j++)
uprintf(s_left+left+3,s_top+top+3+j uprintf(s_left+left+3,s_top+top+3+j
,i==(*cur) lbclr : lclr|(bclr<<4) ,i==*cur ? lbclr
: lclr|(bclr<<4)
,"%-*.*s",width-4,width-4,option[i]); ,"%-*.*s",width-4,width-4,option[i]);
y=top+height-2; break;
case KEY_NPAGE: /* PgDn */
if(!opts)
break;
*cur += (height-5);
if(*cur>opts-1)
*cur = opts-1;
if(bar) if(bar)
(*bar)=height-5; *bar = height-5;
gettext(s_left+3+left,s_top+y y=height-5+s_top+top;
,s_left+left+width-2,s_top+y,line); gotoxy(s_left+left+1,s_top+top+3);
for(i=1;i<148;i+=2) textattr(lclr|(bclr<<4));
line[i]=lbclr; if(*cur>height-5) /* Scroll mode */
puttext(s_left+3+left,s_top+y putch(30); /* put the up arrow */
,s_left+left+width-2,s_top+y,line); else
putch(' '); /* delete the up arrow */
gotoxy(s_left+left+1,s_top+top+height-2);
if(*cur < opts-1)
putch(31); /* put the down arrow */
else
putch(' '); /* delete the down arrow */
for(i=*cur+5-height,j=0;i<=*cur;i++,j++)
uprintf(s_left+left+3,s_top+top+3+j
,i==*cur ? lbclr
: lclr|(bclr<<4)
,"%-*.*s",width-4,width-4,option[i]);
break; break;
#endif
case KEY_END: /* end */ case KEY_END: /* end */
if(!opts) if(!opts)
break; break;
...@@ -889,7 +910,7 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar ...@@ -889,7 +910,7 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
if(bar) { if(bar) {
/* gotoxy(1,1); cprintf("bar=%08lX ",bar); */ /* gotoxy(1,1); cprintf("bar=%08lX ",bar); */
(*bar)=0; (*bar)=0;
} }
} }
else { else {
(*cur)++; (*cur)++;
...@@ -897,7 +918,7 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar ...@@ -897,7 +918,7 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
if(bar && (*bar)<height-5) { if(bar && (*bar)<height-5) {
/* gotoxy(1,1); cprintf("bar=%08lX ",bar); */ /* gotoxy(1,1); cprintf("bar=%08lX ",bar); */
(*bar)++; (*bar)++;
} }
} }
if(y==top+height-1) { /* scroll */ if(y==top+height-1) { /* scroll */
if(*cur==opts-1) { if(*cur==opts-1) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment