From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KiXZv-0003Jm-Nw for mharc-grub-devel@gnu.org; Wed, 24 Sep 2008 12:51:03 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KiXZu-0003JP-08 for grub-devel@gnu.org; Wed, 24 Sep 2008 12:51:02 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KiXZs-0003Ik-Bz for grub-devel@gnu.org; Wed, 24 Sep 2008 12:51:01 -0400 Received: from [199.232.76.173] (port=41816 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KiXZs-0003Id-4C for grub-devel@gnu.org; Wed, 24 Sep 2008 12:51:00 -0400 Received: from 197.red-80-32-81.staticip.rima-tde.net ([80.32.81.197]:35830 helo=mail.pina.cat) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KiXZr-0004do-IV for grub-devel@gnu.org; Wed, 24 Sep 2008 12:51:00 -0400 Received: from pinux (21.61.221.87.dynamic.jazztel.es [87.221.61.21]) by mail.pina.cat (Postfix) with ESMTP id C8BF928906548 for ; Wed, 24 Sep 2008 18:50:57 +0200 (CEST) Received: by pinux (Postfix, from userid 1000) id B850A92A79; Wed, 24 Sep 2008 18:50:56 +0200 (CEST) Date: Wed, 24 Sep 2008 18:50:56 +0200 From: Carles Pina i Estany To: The development of GRUB 2 Message-ID: <20080924165056.GA24548@pina.cat> References: <20080920203745.GA27562@pina.cat> <20080924103424.GK6973@thorin> <20080924160724.GA10087@pina.cat> <20080924163322.GA31610@thorin> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ikeVEW9yuYc//A+q" Content-Disposition: inline In-Reply-To: <20080924163322.GA31610@thorin> 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: Re: [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: Wed, 24 Sep 2008 16:51:02 -0000 --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello, On Sep/24/2008, Robert Millan wrote: > On Wed, Sep 24, 2008 at 06:07:24PM +0200, Carles Pina i Estany wrote: > > > > New patch is attached. I also improved some other thing. > > > > Feedback is welcomed :-) > > There seems to be an off-by-one problem. Try with the attached grub.cfg. should be fine now, sorry. There is two things that I don't like in this world: a) program menus and menus movements b) testing my code :-) (of course I tested but not this case) Regards, -- Carles Pina i Estany GPG id: 0x17756391 http://pinux.info --ikeVEW9yuYc//A+q Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ppage_npage_control06.patch" Index: normal/menu.c =================================================================== --- normal/menu.c (revision 1872) +++ normal/menu.c (working copy) @@ -457,6 +457,57 @@ } } 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': --ikeVEW9yuYc//A+q--