Work on multi-out terminal
This commit is contained in:
parent
a2c1332b70
commit
f4c623e170
21 changed files with 707 additions and 570 deletions
|
@ -37,18 +37,28 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
|
|||
if ((cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) &&
|
||||
(cmd->flags & GRUB_COMMAND_FLAG_CMDLINE))
|
||||
{
|
||||
char description[GRUB_TERM_WIDTH / 2];
|
||||
struct grub_term_output *cur;
|
||||
int desclen = grub_strlen (cmd->summary);
|
||||
for (cur = grub_term_outputs; cur; cur = cur->next)
|
||||
{
|
||||
if (!(cur->flags & GRUB_TERM_ACTIVE))
|
||||
continue;
|
||||
int width = grub_term_width(cur);
|
||||
char description[width / 2];
|
||||
|
||||
/* Make a string with a length of GRUB_TERM_WIDTH / 2 - 1 filled
|
||||
with the description followed by spaces. */
|
||||
grub_memset (description, ' ', GRUB_TERM_WIDTH / 2 - 1);
|
||||
description[GRUB_TERM_WIDTH / 2 - 1] = '\0';
|
||||
grub_memcpy (description, cmd->summary,
|
||||
(desclen < GRUB_TERM_WIDTH / 2 - 1
|
||||
? desclen : GRUB_TERM_WIDTH / 2 - 1));
|
||||
|
||||
grub_printf ("%s%s", description, (cnt++) % 2 ? "\n" : " ");
|
||||
grub_memset (description, ' ', width / 2 - 1);
|
||||
description[width / 2 - 1] = '\0';
|
||||
grub_memcpy (description, cmd->summary,
|
||||
(desclen < width / 2 - 1
|
||||
? desclen : width / 2 - 1));
|
||||
grub_puts_terminal (description, cur);
|
||||
}
|
||||
if ((cnt++) % 2)
|
||||
grub_printf ("\n");
|
||||
else
|
||||
grub_printf (" ");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -32,12 +32,12 @@ static const struct grub_arg_option options[] =
|
|||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static grub_uint8_t x, y;
|
||||
static grub_uint16_t *pos;
|
||||
|
||||
static void
|
||||
do_print (int n)
|
||||
{
|
||||
grub_gotoxy (x, y);
|
||||
grub_term_restore_pos (pos);
|
||||
/* NOTE: Do not remove the trailing space characters.
|
||||
They are required to clear the line. */
|
||||
grub_printf ("%d ", n);
|
||||
|
@ -63,7 +63,6 @@ static grub_err_t
|
|||
grub_cmd_sleep (grub_extcmd_t cmd, int argc, char **args)
|
||||
{
|
||||
struct grub_arg_list *state = cmd->state;
|
||||
grub_uint16_t xy;
|
||||
int n;
|
||||
|
||||
if (argc != 1)
|
||||
|
@ -77,9 +76,7 @@ grub_cmd_sleep (grub_extcmd_t cmd, int argc, char **args)
|
|||
return 0;
|
||||
}
|
||||
|
||||
xy = grub_getxy ();
|
||||
x = xy >> 8;
|
||||
y = xy & 0xff;
|
||||
pos = grub_term_save_pos ();
|
||||
|
||||
for (; n; n--)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue