summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/main.c b/main.c
index 58b2b4a..40ecdcb 100644
--- a/main.c
+++ b/main.c
@@ -11,6 +11,7 @@ _Noreturn static void finish(int sig);
void display_custom_form(FORM *);
void print_contract(WINDOW *w, int x, int y, contract *c);
int run_sim(FORM *, char **contract_subtypes);
+int min(int a, int b);
int main() {
int ch, i;
@@ -122,6 +123,16 @@ int main() {
pnoutrefresh(pad, padscroll, 0, 4, 1, HEIGHT-2, WIDTH-1);
doupdate();
break;
+ case KEY_NPAGE:
+ padscroll += min(HEIGHT - 6, duration - padscroll);
+ pnoutrefresh(pad, padscroll, 0, 4, 1, HEIGHT-2, WIDTH-1);
+ doupdate();
+ break;
+ case KEY_PPAGE:
+ padscroll -= min(HEIGHT - 6, padscroll);
+ pnoutrefresh(pad, padscroll, 0, 4, 1, HEIGHT-2, WIDTH-1);
+ doupdate();
+ break;
case 'q':
display_custom_form(form);
formactive = TRUE;
@@ -203,3 +214,7 @@ int run_sim(FORM *form, char **contract_subtypes) {
return 1;
}
+
+int min(int a, int b) {
+ return (a < b) ? a : b;
+}