support prev and next page keys
authorLaurent MAZET <laurent.mazet@thalesgroup.com>
Tue, 8 Oct 2024 12:44:35 +0000 (14:44 +0200)
committerLaurent MAZET <laurent.mazet@thalesgroup.com>
Tue, 8 Oct 2024 12:44:35 +0000 (14:44 +0200)
ndisplay.c

index ac41fd2ffe7d63ceab90de41f47268a84ee113fe..614e3639a37768714285aba01675b95abaf9cb83 100644 (file)
@@ -285,6 +285,32 @@ int main (int argc, char *argv[])
                 change = 1;
             }
             break;
+        case KEY_PPAGE:
+        case 'I':
+            if (ycursor > 0) {
+                ycursor = max (0, ycursor - LINES / 2);
+                change = 1;
+            }
+            break;
+        case 'J':
+            if (xcursor > 0) {
+                xcursor = max (0, xcursor - COLS / 2);
+                change = 1;
+            }
+            break;
+        case KEY_NPAGE:
+        case 'K':
+            if (images[scale]->height - ycursor > LINES) {
+                ycursor = min (ycursor + LINES / 2, images[scale]->height - LINES);
+                change = 1;
+            }
+            break;
+        case 'L':
+            if (images[scale]->width - xcursor > COLS / mode) {
+                xcursor = min (xcursor + COLS / 2, images[scale]->width - COLS);
+                change = 1;
+            }
+            break;
         }
     }