All of lore.kernel.org
 help / color / mirror / Atom feed
From: Carles Pina i Estany <carles@pina.cat>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] Menu control for NPAGE and PPAGE
Date: Wed, 24 Sep 2008 18:50:56 +0200	[thread overview]
Message-ID: <20080924165056.GA24548@pina.cat> (raw)
In-Reply-To: <20080924163322.GA31610@thorin>

[-- Attachment #1: Type: text/plain, Size: 555 bytes --]


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

[-- Attachment #2: ppage_npage_control06.patch --]
[-- Type: text/x-diff, Size: 1330 bytes --]

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':

  reply	other threads:[~2008-09-24 16:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-20 20:37 [PATCH] Menu control for NPAGE and PPAGE Carles Pina i Estany
2008-09-24 10:34 ` Robert Millan
2008-09-24 16:07   ` Carles Pina i Estany
2008-09-24 16:33     ` Robert Millan
2008-09-24 16:50       ` Carles Pina i Estany [this message]
2008-09-24 17:07         ` Carles Pina i Estany
2008-10-21 18:39         ` Carles Pina i Estany
2008-10-21 22:09           ` Pavel Roskin
2008-10-25 19:02             ` Carles Pina i Estany
2008-11-01 12:42               ` Robert Millan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080924165056.GA24548@pina.cat \
    --to=carles@pina.cat \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.