]> git.decadent.org.uk Git - ap-utils.git/blobdiff - lib/file.c
Imported Upstream version 1.5~pre2
[ap-utils.git] / lib / file.c
index 22dbf7a0f5deb303406f711e5ea87e280498fbb3..fa2746fc8d0c97bf1e88144c2180bd9a7c55c399 100644 (file)
@@ -356,6 +356,42 @@ wrong_num:
                }
                continue;
 
+           case KEY_NPAGE:
+               if (end < record_num) {
+                   end = (end + (MAX_LINES) - 1 < record_num) ?
+                       end + (MAX_LINES) - 1 : record_num;
+                   begin = (end - (MAX_LINES) + 1 > 0) ?
+                       end - (MAX_LINES) + 1 : 1;
+                   _scroll_rows(first, begin, end);
+               }
+               continue;
+
+           case KEY_PPAGE:
+               if (begin > 1) {
+                   begin = (begin - (MAX_LINES) + 1 > 0) ?
+                       begin - (MAX_LINES) + 1 : 1;
+                   end = (begin + (MAX_LINES) - 1 < record_num) ?
+                       begin + (MAX_LINES) - 1 : record_num;
+                   _scroll_rows(first, begin, end);
+               }
+               continue;
+
+           case KEY_END:
+               if (end < record_num) {
+                   begin = (record_num > MAX_LINES) ? record_num + 1 - (MAX_LINES) : 1;
+                   end = record_num;
+                   _scroll_rows(first, begin, end);
+               }
+               continue;
+
+           case KEY_HOME:
+               if (begin > 1) {
+                   begin = 1;
+                   end = (record_num > MAX_LINES) ? MAX_LINES : record_num;
+                   _scroll_rows(first, begin, end);
+               }
+               continue;
+
            case 'w':
            case 'W':
                sprintf(buf, "%s/.ap-config", home_dir);
@@ -368,14 +404,10 @@ wrong_num:
                        curr = curr->next;
                    }
                    close(fd);
-                   print_help(
-                       _("AP list file ~/.ap-config successfully written. "
-                         "Press any key."));
-               } else {
-                   print_helperr(
-                       _("Unable to write AP list file ~/.ap-config. "
-                         "Press any key."));
-               }
+                   print_help(DONE_WRITING_APCONF);
+               } else
+                   print_helperr(ERR_WRITING_APCONF);
+
                getch();
                continue;
        }