From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KJbGG-0005Nt-8b for mharc-grub-devel@gnu.org; Thu, 17 Jul 2008 17:43:40 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KJbGD-0005NN-To for grub-devel@gnu.org; Thu, 17 Jul 2008 17:43:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KJbG2-0005JX-Pp for grub-devel@gnu.org; Thu, 17 Jul 2008 17:43:37 -0400 Received: from [199.232.76.173] (port=50088 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJbG2-0005JR-LJ for grub-devel@gnu.org; Thu, 17 Jul 2008 17:43:26 -0400 Received: from 197.red-80-32-81.staticip.rima-tde.net ([80.32.81.197]:48966 helo=mail.pina.cat) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KJbG0-0003lk-Ap for grub-devel@gnu.org; Thu, 17 Jul 2008 17:43:26 -0400 Received: from pinux (91.80.221.87.dynamic.jazztel.es [87.221.80.91]) by mail.pina.cat (Postfix) with ESMTP id 85607288FBA1B for ; Thu, 17 Jul 2008 23:22:28 +0200 (CEST) Received: by pinux (Postfix, from userid 1000) id 4D8DAA0669; Thu, 17 Jul 2008 23:22:27 +0200 (CEST) Date: Thu, 17 Jul 2008 23:22:27 +0200 From: Carles Pina i Estany To: grub-devel@gnu.org Message-ID: <20080717212227.GA11725@pina.cat> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="WIyZ46R2i8wDzkSu" Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-Greylist: delayed 1254 seconds by postgrey-1.27 at monty-python; Thu, 17 Jul 2008 17:43:24 EDT Subject: menu loop (patch) 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: Thu, 17 Jul 2008 21:43:38 -0000 --WIyZ46R2i8wDzkSu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello, I'm a Grub user (thanks for your nice work!) and I always wanted to have a menu that "loops". Like, if you press down and you are in the last option it goes to the first one, and if you press up but you are int he first option goes to the last. Attached comes a patch against revision 1718. Of course, feel free to comment anything about it. I'm open to change, fix, etc. I also don't know if this functionality is not in Grub because you thought that was better to not have this functionality. I've copied/change a few lines (after the patch, lines 425-428 are the same than lines 347-350). I don't think that it's needed to refactor but if you think so I can do it. Thank you, -- Carles Pina i Estany GPG id: 0x8CBDAE64 http://pinux.info Manresa - Barcelona --WIyZ46R2i8wDzkSu Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="menu_loop.patch" Index: normal/menu.c =================================================================== --- normal/menu.c (revision 1717) +++ normal/menu.c (working copy) @@ -420,6 +420,17 @@ first--; print_entries (menu, first, offset); } + else if (first==0) + { + // Highlight the last entry + offset = menu->size - 1; + if (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 14: @@ -440,6 +451,13 @@ print_entries (menu, first, offset); } } + else + { + // Highlight the first entry + first=0; + offset=0; + print_entries (menu, first, offset); + } break; case '\n': --WIyZ46R2i8wDzkSu--