]> git.proxmox.com Git - grub2.git/commitdiff
2009-03-06 Robert Millan <rmh@aybabtu.com>
authorrobertmh <robertmh@localhost>
Fri, 6 Mar 2009 19:10:23 +0000 (19:10 +0000)
committerrobertmh <robertmh@localhost>
Fri, 6 Mar 2009 19:10:23 +0000 (19:10 +0000)
        Fix display issue on terminals with screen size other than 80x25
        (e.g. gfxterm with resolution higher than 640x480).

        * normal/main.c (grub_normal_init_page): Display title text in a
        position relative to the center of the terminal instead of reliing
        on a hardcoded offset.

ChangeLog
normal/main.c

index 1e472cfa4b954b08205ebfe6db49b8c6eb621c07..5d81a1e42df90e0a53aebed1154eac808e1e0187 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-03-06  Robert Millan  <rmh@aybabtu.com>
+
+       Fix display issue on terminals with screen size other than 80x25
+       (e.g. gfxterm with resolution higher than 640x480).
+
+       * normal/main.c (grub_normal_init_page): Display title text in a
+       position relative to the center of the terminal instead of reliing
+       on a hardcoded offset.
+
 2009-03-04  Robert Millan  <rmh@aybabtu.com>
 
        Filter /etc/grub.d/10_* so that only add-ons for native kernels are
index a0c01355545e5661ab84ae2e3aa039c203210388..ea60b83745b5c92fe7afa68e26983692de6cacc0 100644 (file)
@@ -389,10 +389,22 @@ grub_enter_normal_mode (const char *config)
 void
 grub_normal_init_page (void)
 {
+  grub_uint8_t width, margin;
+
+#define TITLE ("GNU GRUB  version " PACKAGE_VERSION)
+
+  width = grub_getwh () >> 8;
+  margin = (width - (sizeof(TITLE) + 7)) / 2;
+
   grub_cls ();
-  grub_printf ("\n\
-                         GNU GRUB  version %s\n\n",
-              PACKAGE_VERSION);
+  grub_putchar ('\n');
+
+  while (margin--)
+    grub_putchar (' ');
+
+  grub_printf ("%s\n\n", TITLE);
+
+#undef TITLE
 }
 
 /* Read the file command.lst for auto-loading.  */