Progressively skip menu elements on small terminals rather

than crashing.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-05-14 08:57:18 +02:00
parent c8d6cc3cf0
commit cdce14fad4
10 changed files with 798 additions and 675 deletions

View file

@ -48,9 +48,23 @@ extern int grub_normal_exit_level;
/* Defined in `main.c'. */
void grub_enter_normal_mode (const char *config);
void grub_normal_execute (const char *config, int nested, int batch);
void grub_menu_init_page (int nested, int edit, int *num_entries,
struct grub_term_screen_geometry
{
/* The number of entries shown at a time. */
int num_entries;
int first_entry_y;
int first_entry_x;
int entry_width;
int timeout_y;
int timeout_lines;
int border;
int right_margin;
};
void grub_menu_init_page (int nested, int edit,
struct grub_term_screen_geometry *geo,
struct grub_term_output *term);
void grub_normal_init_page (struct grub_term_output *term);
void grub_normal_init_page (struct grub_term_output *term, int y);
char *grub_file_getline (grub_file_t file);
void grub_cmdline_run (int nested);

View file

@ -124,25 +124,12 @@ grub_term_color_state;
/* Menu-related geometrical constants. */
/* The number of lines of "GRUB version..." at the top. */
#define GRUB_TERM_INFO_HEIGHT 1
/* The number of columns/lines between messages/borders/etc. */
#define GRUB_TERM_MARGIN 1
/* The number of columns of scroll information. */
#define GRUB_TERM_SCROLL_WIDTH 1
/* The Y position of the top border. */
#define GRUB_TERM_TOP_BORDER_Y (GRUB_TERM_MARGIN + GRUB_TERM_INFO_HEIGHT \
+ GRUB_TERM_MARGIN)
/* The X position of the left border. */
#define GRUB_TERM_LEFT_BORDER_X GRUB_TERM_MARGIN
/* The Y position of the first entry. */
#define GRUB_TERM_FIRST_ENTRY_Y (GRUB_TERM_TOP_BORDER_Y + 1)
struct grub_term_input
{
/* The next terminal. */
@ -340,13 +327,6 @@ static inline unsigned grub_term_height (struct grub_term_output *term)
return (term->getwh(term)&0xFF);
}
/* The width of the border. */
static inline unsigned
grub_term_border_width (struct grub_term_output *term)
{
return grub_term_width (term) - GRUB_TERM_MARGIN * 2;
}
static inline grub_uint16_t
grub_term_getxy (struct grub_term_output *term)
{

View file

@ -210,6 +210,7 @@ enum
GRUB_UNICODE_UPARROW = 0x2191,
GRUB_UNICODE_RIGHTARROW = 0x2192,
GRUB_UNICODE_DOWNARROW = 0x2193,
GRUB_UNICODE_UPDOWNARROW = 0x2195,
GRUB_UNICODE_LIGHT_HLINE = 0x2500,
GRUB_UNICODE_HLINE = 0x2501,
GRUB_UNICODE_LIGHT_VLINE = 0x2502,