coreinfo: Default to first non-empty category

... instead of the overall first one.

Change-Id: If9b2674ff2ef83b7c24a3388316b6f4128bc1007
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Reviewed-on: https://review.coreboot.org/14027
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Jonathan Neuschäfer 2016-03-10 06:33:00 +01:00 committed by Martin Roth
parent 5368504e44
commit ff09952921
1 changed files with 11 additions and 0 deletions

View File

@ -225,6 +225,16 @@ static void print_no_modules_selected(void)
center(height / 2, "No modules selected");
}
static int first_nonempty_category(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(categories); i++)
if (categories[i].count > 0)
return i;
return 0;
}
static void loop(void)
{
int key;
@ -233,6 +243,7 @@ static void loop(void)
print_no_modules_selected();
refresh();
curwin = first_nonempty_category();
print_menu();
print_submenu(&categories[curwin]);
redraw_module(&categories[curwin]);