--- grub-2.00.tar/grub-2.00/grub-core/gfxmenu/view.c 2012-02-24 11:19:45.000000000 +0100 +++ grub-2.00/grub-core/gfxmenu/view.c 2012-10-07 12:53:04.000000000 +0200 @@ -361,11 +361,31 @@ static void init_terminal (grub_gfxmenu_view_t view) { - term_rect.width = view->screen.width * 7 / 10; + int border_width = 3; + + grub_font_t terminal_font = grub_font_get (view->terminal_font_name); + + /* Get the with of a line containing 80 x "m": */ + unsigned int line_width = grub_font_get_string_width (terminal_font, "m") * 80 + + 2 * border_width; + + if ( view->screen.width <= line_width ) { + /* The screen is too small. Use all space, except a small border + to show the user, it is a window and not full screen: */ + term_rect.width = view->screen.width - 6 * border_width; + } else { + /* The screen is big enough. Try 70% of the screen width: */ + term_rect.width = view->screen.width * 7 / 10; + /* Make sure, that we use at least the line_width: */ + if ( term_rect.width < line_width ) { + term_rect.width = line_width; + } + } + term_rect.height = view->screen.height * 7 / 10; - term_rect.x = view->screen.x + view->screen.width * (10 - 7) / 10 / 2; - term_rect.y = view->screen.y + view->screen.height * (10 - 7) / 10 / 2; + term_rect.x = view->screen.x + (view->screen.width - term_rect.width) / 2; + term_rect.y = view->screen.y + (view->screen.height - term_rect.height) / 2; term_view = view; @@ -375,7 +395,8 @@ grub_gfxterm_set_window (GRUB_VIDEO_RENDER_TARGET_DISPLAY, term_rect.x, term_rect.y, term_rect.width, term_rect.height, - view->double_repaint, view->terminal_font_name, 3); + view->double_repaint, view->terminal_font_name, + border_width); grub_gfxterm_decorator_hook = grub_gfxmenu_draw_terminal_box; }