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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue