From 1432e958900f9bdafa784bd0bf8b95a148c06ee0 Mon Sep 17 00:00:00 2001 From: robertmh Date: Sat, 1 Nov 2008 12:42:27 +0000 Subject: [PATCH] 2008-11-01 Carles Pina i Estany * normal/menu.c (run_menu): Add Previous and Next Page keys in menu. --- ChangeLog | 4 ++++ normal/menu.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/ChangeLog b/ChangeLog index 430a37b78..efc26e947 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-11-01 Carles Pina i Estany + + * normal/menu.c (run_menu): Add Previous and Next Page keys in menu. + 2008-10-29 Guillem Jover * disk/lvm.c (grub_lvm_scan_device): Fix error recovery by delaying the diff --git a/normal/menu.c b/normal/menu.c index d6fc0a33e..103aa6f15 100644 --- a/normal/menu.c +++ b/normal/menu.c @@ -457,6 +457,57 @@ run_menu (grub_menu_t menu, int nested) } } break; + + case GRUB_TERM_PPAGE: + if (first == 0) + { + offset = 0; + } + else + { + first -= GRUB_TERM_NUM_ENTRIES; + + if (first < 0) + { + offset += first; + first = 0; + } + } + print_entries (menu, first, offset); + break; + + case GRUB_TERM_NPAGE: + if (offset == 0) + { + offset += GRUB_TERM_NUM_ENTRIES - 1; + if (first + offset >= menu->size) + { + offset = menu->size - first - 1; + } + } + else + { + first += GRUB_TERM_NUM_ENTRIES; + + if (first + offset >= menu->size) + { + first -= GRUB_TERM_NUM_ENTRIES; + offset += GRUB_TERM_NUM_ENTRIES; + + if (offset > menu->size - 1 || + offset > GRUB_TERM_NUM_ENTRIES - 1) + { + offset = menu->size - first - 1; + } + if (offset > GRUB_TERM_NUM_ENTRIES) + { + first += offset - GRUB_TERM_NUM_ENTRIES + 1; + offset = GRUB_TERM_NUM_ENTRIES - 1; + } + } + } + print_entries (menu, first, offset); + break; case '\n': case '\r':