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
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':
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to