Use `MAX()` to make codes more readable.
[smdp.git] / src / viewer.c
index 81614e1..a82b0d0 100644 (file)
@@ -117,7 +117,7 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert) {
                     }
 
                     // set max_cols
-                    max_cols = (i > max_cols) ? i : max_cols;
+                    max_cols = MAX(i, max_cols);
 
                     // iterate to next line
                     offset = prev_blank(line->text, offset + COLS);
@@ -125,16 +125,16 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert) {
                     lc++;
                 }
                 // set max_cols one last time
-                max_cols = (i > max_cols) ? i : max_cols;
+                max_cols = MAX(i, max_cols);
             } else {
                 // set max_cols
-                max_cols = (line->length > max_cols) ? line->length : max_cols;
+                max_cols = MAX(line->length, max_cols);
             }
             lc++;
             line = line->next;
         }
 
-        max_lines = (lc > max_lines) ? lc : max_lines;
+        max_lines = MAX(lc, max_lines);
 
         slide = slide->next;
     }
@@ -297,6 +297,7 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert) {
             // show previous slide
             case KEY_UP:
             case KEY_LEFT:
+            case KEY_PPAGE:
             case 8:   // BACKSPACE (ascii)
             case 127: // BACKSPACE (xterm)
             case 263: // BACKSPACE (getty)
@@ -313,6 +314,7 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert) {
             // show next slide
             case KEY_DOWN:
             case KEY_RIGHT:
+            case KEY_NPAGE:
             case '\n': // ENTER
             case ' ':  // SPACE
             case 'j':
@@ -377,7 +379,7 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert) {
             case 'q':
                 // do not fade out on exit
                 fade = 0;
-                slide = (void*)0;
+                slide = NULL;
                 break;
 
             default: