Various fixes to make multiterm work
This commit is contained in:
parent
4fc4ee303d
commit
fa533ebb5c
5 changed files with 36 additions and 11 deletions
|
@ -359,6 +359,18 @@ grub_term_setcursor (struct grub_term_output *term, int on)
|
|||
term->setcursor (on);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_cls (struct grub_term_output *term)
|
||||
{
|
||||
if (term->cls)
|
||||
(term->cls) ();
|
||||
else
|
||||
{
|
||||
grub_putcode ('\n', term);
|
||||
grub_term_refresh (term);
|
||||
}
|
||||
}
|
||||
|
||||
static inline grub_ssize_t
|
||||
grub_term_getcharwidth (struct grub_term_output *term, grub_uint32_t c)
|
||||
{
|
||||
|
@ -372,7 +384,13 @@ static inline void
|
|||
grub_term_getcolor (struct grub_term_output *term,
|
||||
grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
|
||||
{
|
||||
term->getcolor (normal_color, highlight_color);
|
||||
if (term->getcolor)
|
||||
term->getcolor (normal_color, highlight_color);
|
||||
else
|
||||
{
|
||||
*normal_color = 0x07;
|
||||
*highlight_color = 0x07;
|
||||
}
|
||||
}
|
||||
|
||||
extern void (*EXPORT_VAR (grub_newline_hook)) (void);
|
||||
|
|
|
@ -132,7 +132,7 @@ grub_cls (void)
|
|||
if ((term->flags & GRUB_TERM_DUMB) || (grub_env_get ("debug")))
|
||||
{
|
||||
grub_putcode ('\n', term);
|
||||
grub_refresh ();
|
||||
grub_term_refresh (term);
|
||||
}
|
||||
else
|
||||
(term->cls) ();
|
||||
|
|
|
@ -409,7 +409,7 @@ grub_normal_init_page (struct grub_term_output *term)
|
|||
grub_uint32_t *unicode_msg;
|
||||
grub_uint32_t *last_position;
|
||||
|
||||
grub_cls ();
|
||||
grub_term_cls (term);
|
||||
|
||||
grub_sprintf (msg_formatted, msg, PACKAGE_VERSION);
|
||||
|
||||
|
|
|
@ -391,13 +391,15 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
|
|||
|
||||
case GRUB_TERM_UP:
|
||||
case '^':
|
||||
current_entry--;
|
||||
if (current_entry > 0)
|
||||
current_entry--;
|
||||
menu_set_chosen_entry (current_entry);
|
||||
break;
|
||||
|
||||
case GRUB_TERM_DOWN:
|
||||
case 'v':
|
||||
current_entry++;
|
||||
if (current_entry < menu->size - 1)
|
||||
current_entry++;
|
||||
menu_set_chosen_entry (current_entry);
|
||||
break;
|
||||
|
||||
|
@ -411,9 +413,9 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
|
|||
|
||||
case GRUB_TERM_NPAGE:
|
||||
if (current_entry + GRUB_MENU_PAGE_SIZE < menu->size)
|
||||
current_entry = 0;
|
||||
else
|
||||
current_entry += GRUB_MENU_PAGE_SIZE;
|
||||
else
|
||||
current_entry = menu->size - 1;
|
||||
menu_set_chosen_entry (current_entry);
|
||||
break;
|
||||
|
||||
|
|
|
@ -202,8 +202,8 @@ entry is highlighted.\n");
|
|||
|
||||
if (nested)
|
||||
{
|
||||
grub_printf ("\n ");
|
||||
grub_printf_ (N_("ESC to return previous menu."));
|
||||
grub_puts_terminal ("\n ", term);
|
||||
grub_puts_terminal (_("ESC to return previous menu."), term);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -385,10 +385,11 @@ menu_text_set_chosen_entry (int entry, void *dataptr)
|
|||
struct menu_viewer_data *data = dataptr;
|
||||
int oldoffset = data->offset;
|
||||
int complete_redraw = 0;
|
||||
|
||||
data->offset = entry - data->first;
|
||||
if (data->offset > grub_term_num_entries (data->term) - 1)
|
||||
{
|
||||
data->first = data->offset - (grub_term_num_entries (data->term) - 1);
|
||||
data->first = entry - (grub_term_num_entries (data->term) - 1);
|
||||
data->offset = grub_term_num_entries (data->term) - 1;
|
||||
complete_redraw = 1;
|
||||
}
|
||||
|
@ -418,6 +419,8 @@ menu_text_fini (void *dataptr)
|
|||
struct menu_viewer_data *data = dataptr;
|
||||
|
||||
grub_term_setcursor (data->term, 1);
|
||||
grub_term_cls (data->term);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -456,6 +459,7 @@ grub_menu_text_register_instances (int entry, grub_menu_t menu, int nested)
|
|||
grub_errno = GRUB_ERR_NONE;
|
||||
continue;
|
||||
}
|
||||
|
||||
data->term = term;
|
||||
instance->data = data;
|
||||
instance->set_chosen_entry = menu_text_set_chosen_entry;
|
||||
|
@ -477,5 +481,6 @@ grub_menu_text_register_instances (int entry, grub_menu_t menu, int nested)
|
|||
grub_menu_init_page (nested, 0, data->term);
|
||||
print_entries (menu, data->first, data->offset, data->term);
|
||||
grub_term_refresh (data->term);
|
||||
grub_menu_register_viewer (instance);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue