88c194b
diff -r a5a3f48e92c9 tools/pygrub/src/pygrub
88c194b
--- a/tools/pygrub/src/pygrub	Wed Oct 04 19:00:11 2006 +0100
88c194b
+++ b/tools/pygrub/src/pygrub	Wed Oct 04 17:55:19 2006 -0400
88c194b
@@ -25,7 +25,7 @@ import grub.GrubConf
88c194b
 import grub.GrubConf
88c194b
 import grub.fsys
88c194b
 
88c194b
-PYGRUB_VER = 0.5
88c194b
+PYGRUB_VER = 0.6
88c194b
 
88c194b
 def enable_cursor(ison):
88c194b
     if ison:
88c194b
@@ -167,15 +167,22 @@ class Grub:
88c194b
     def fill_entry_list(self):
88c194b
         self.entry_win.clear()
88c194b
         self.entry_win.box()
88c194b
-        for y in range(0, len(self.cf.images)):
88c194b
+
88c194b
+        maxy = self.entry_win.getmaxyx()[0]-3 # maxy - 2 for the frame + index
88c194b
+        if self.selected_image > self.start_image + maxy:
88c194b
+            self.start_image = self.selected_image
88c194b
+        if self.selected_image < self.start_image:
88c194b
+            self.start_image = self.selected_image
88c194b
+        
88c194b
+        for y in range(self.start_image, len(self.cf.images)):
88c194b
             i = self.cf.images[y]
88c194b
-            if (0, y) > self.entry_win.getmaxyx():
88c194b
+            if y > self.start_image + maxy:
88c194b
                 break
88c194b
             if y == self.selected_image:
88c194b
                 attr = curses.A_REVERSE
88c194b
             else:
88c194b
                 attr = 0
88c194b
-            self.entry_win.addstr(y + 1, 2, i.title.ljust(70), attr)
88c194b
+            self.entry_win.addstr(y + 1 - self.start_image, 2, i.title.ljust(70), attr)
88c194b
         self.entry_win.refresh()
88c194b
 
88c194b
     def edit_entry(self, origimg):
88c194b
@@ -364,6 +371,7 @@ class Grub:
88c194b
 
88c194b
         # now loop until we hit the timeout or get a go from the user
88c194b
         mytime = 0
88c194b
+        self.start_image = 0
88c194b
         while (timeout == -1 or mytime < int(timeout)):
88c194b
             draw()
88c194b
             if timeout != -1 and mytime != -1: