Hello,

(This patch includes the changes for GRUB_TERM_NPAGE/PPAGE macros, that
I sent in a previous mail)

ChangeLog:
--------
2008-09-20  Carles Pina i Estany  <[EMAIL PROTECTED]>
        * normal/menu.c (run_menu): Add Previous and Next Page keys in
        grub-menu.

        * include/grub/powerpc/ieee1275/console.h (GRUB_TERM_NPAGE):
        Changed to 0x5100.
        (GRUB_TERM_PPAGE): Changed to 0x4900.

        * include/grub/sparc64/ieee1275/console.h: Likewise.

        * include/grub/i386/pc/console.h: Likewise.

        * include/grub/efi/console.h: Likewise.
--------

I've tested using several grub.cfg files.

Feel free to commit or test (I would fix any error, please send a step by step
user-case that fails -number of elements in the menu, description of what you
do)

Thanks,

-- 
Carles Pina i Estany            GPG id: 0x17756391
        http://pinux.info
Index: include/grub/powerpc/ieee1275/console.h
===================================================================
--- include/grub/powerpc/ieee1275/console.h	(revision 1864)
+++ include/grub/powerpc/ieee1275/console.h	(working copy)
@@ -29,8 +29,8 @@
 #define GRUB_CONSOLE_KEY_BACKSPACE	0x0008
 #define GRUB_CONSOLE_KEY_HOME		0x4700
 #define GRUB_CONSOLE_KEY_END		0x4F00
-#define GRUB_CONSOLE_KEY_NPAGE		0x4900
-#define GRUB_CONSOLE_KEY_PPAGE		0x5100
+#define GRUB_CONSOLE_KEY_NPAGE		0x5100
+#define GRUB_CONSOLE_KEY_PPAGE		0x4900
 
 /* Initialize the console system.  */
 void grub_console_init (void);
Index: include/grub/sparc64/ieee1275/console.h
===================================================================
--- include/grub/sparc64/ieee1275/console.h	(revision 1864)
+++ include/grub/sparc64/ieee1275/console.h	(working copy)
@@ -30,8 +30,8 @@
 #define GRUB_CONSOLE_KEY_BACKSPACE	0x0008
 #define GRUB_CONSOLE_KEY_HOME		0x4700
 #define GRUB_CONSOLE_KEY_END		0x4F00
-#define GRUB_CONSOLE_KEY_NPAGE		0x4900
-#define GRUB_CONSOLE_KEY_PPAGE		0x5100
+#define GRUB_CONSOLE_KEY_NPAGE		0x5100
+#define GRUB_CONSOLE_KEY_PPAGE		0x4900
 
 /* Initialize the console system.  */
 void grub_console_init (void);
Index: include/grub/i386/pc/console.h
===================================================================
--- include/grub/i386/pc/console.h	(revision 1864)
+++ include/grub/i386/pc/console.h	(working copy)
@@ -29,8 +29,8 @@
 #define GRUB_CONSOLE_KEY_BACKSPACE	0x0008
 #define GRUB_CONSOLE_KEY_HOME		0x4700
 #define GRUB_CONSOLE_KEY_END		0x4F00
-#define GRUB_CONSOLE_KEY_NPAGE		0x4900
-#define GRUB_CONSOLE_KEY_PPAGE		0x5100
+#define GRUB_CONSOLE_KEY_NPAGE		0x5100
+#define GRUB_CONSOLE_KEY_PPAGE		0x4900
 
 #ifndef ASM_FILE
 
Index: include/grub/efi/console.h
===================================================================
--- include/grub/efi/console.h	(revision 1864)
+++ include/grub/efi/console.h	(working copy)
@@ -29,8 +29,8 @@
 #define GRUB_CONSOLE_KEY_BACKSPACE	0x0008
 #define GRUB_CONSOLE_KEY_HOME		0x4700
 #define GRUB_CONSOLE_KEY_END		0x4F00
-#define GRUB_CONSOLE_KEY_NPAGE		0x4900
-#define GRUB_CONSOLE_KEY_PPAGE		0x5100
+#define GRUB_CONSOLE_KEY_NPAGE		0x5100
+#define GRUB_CONSOLE_KEY_PPAGE		0x4900
 
 #include <grub/types.h>
 #include <grub/symbol.h>
Index: normal/menu.c
===================================================================
--- normal/menu.c	(revision 1864)
+++ normal/menu.c	(working copy)
@@ -457,6 +457,52 @@
 		    }
 		}
 	      break;
+	    
+	    case GRUB_TERM_PPAGE:
+	      if (first == 0)
+		{
+		  offset = 0;
+		}
+	      else
+		{
+		  first = first - GRUB_TERM_NUM_ENTRIES;
+
+		  if (first < 0)
+		    {
+		      offset = offset + first;
+		      first = 0;
+		    }
+		}
+	      print_entries (menu, first, offset);
+	      break;
+
+	    case GRUB_TERM_NPAGE:
+	      if (offset==0)
+		{
+		  offset = offset + GRUB_TERM_NUM_ENTRIES -1 ;
+		  if (first+offset>menu->size)
+		    {
+		      offset=menu->size-first-1;
+		    }
+		}
+	      else
+		{
+		  first = first + GRUB_TERM_NUM_ENTRIES;
+			
+		  if (first + offset >= menu->size)
+		    {
+		      first = first - GRUB_TERM_NUM_ENTRIES;
+		      offset = menu->size - 1;
+		      
+		      if (offset > menu->size - 1 || offset > GRUB_TERM_NUM_ENTRIES - 1)
+			{
+			  first = offset - (GRUB_TERM_NUM_ENTRIES - 1);
+			  offset = GRUB_TERM_NUM_ENTRIES - 1;
+			}
+		    }
+		}
+	      print_entries (menu, first, offset);
+	      break;
 	      
 	    case '\n':
 	    case '\r':
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to