From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Kh9DC-000415-9Q for mharc-grub-devel@gnu.org; Sat, 20 Sep 2008 16:37:50 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kh9DA-00040k-Cq for grub-devel@gnu.org; Sat, 20 Sep 2008 16:37:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kh9D9-00040Q-Ps for grub-devel@gnu.org; Sat, 20 Sep 2008 16:37:48 -0400 Received: from [199.232.76.173] (port=57561 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kh9D9-00040M-M4 for grub-devel@gnu.org; Sat, 20 Sep 2008 16:37:47 -0400 Received: from 197.red-80-32-81.staticip.rima-tde.net ([80.32.81.197]:36864 helo=mail.pina.cat) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kh9D8-0007cL-SB for grub-devel@gnu.org; Sat, 20 Sep 2008 16:37:47 -0400 Received: from pinux (unknown [192.168.0.68]) by mail.pina.cat (Postfix) with ESMTP id 14BD5288FBA19 for ; Sat, 20 Sep 2008 22:37:46 +0200 (CEST) Received: by pinux (Postfix, from userid 1000) id 9E68E8046; Sat, 20 Sep 2008 22:37:45 +0200 (CEST) Date: Sat, 20 Sep 2008 22:37:45 +0200 From: Carles Pina i Estany To: grub-devel@gnu.org Message-ID: <20080920203745.GA27562@pina.cat> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="opJtzjQTFsWo+cga" Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: [PATCH] Menu control for NPAGE and PPAGE X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Sep 2008 20:37:48 -0000 --opJtzjQTFsWo+cga Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 * 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 --opJtzjQTFsWo+cga Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ppage_npage_control01.patch" 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 #include 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': --opJtzjQTFsWo+cga--