From aae5e6f779ea854b312f5f13f24f7d5041ff9c20 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Fri, 4 Feb 2022 22:25:34 +0100 Subject: [PATCH] menu: Support using 1-9 to boot menu entries --- .gitignore | 26 +++++++++++++------------- common/menu.c | 11 +++++++++++ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 0563dd49..879dc0c9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,19 +3,19 @@ /toolchain /reduced-gnu-efi /ovmf* -/*.o -/*.d -/*.a -/*.exe -/*.EFI -/*.bin -/*.bin.gz -/*.tar.xz -/*.tar.gz -/*.elf -/*.hdd -/*.iso -/*.sys +*.o +*.d +*.a +*.exe +*.EFI +*.bin +*.bin.gz +*.tar.xz +*.tar.gz +*.elf +*.hdd +*.iso +*.sys /bochsout.txt /bx_enh_dbg.ini /.vscode diff --git a/common/menu.c b/common/menu.c index f4663340..4d7efd4f 100644 --- a/common/menu.c +++ b/common/menu.c @@ -821,6 +821,17 @@ refresh: c = getchar(); timeout_aborted: switch (c) { + case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': { + int ent = (c - '0') - 1; + if (ent < (int)max_entries) { + selected_entry = ent; + print_tree(NULL, 0, 0, selected_entry, menu_tree, + &selected_menu_entry); + goto autoboot; + } + goto refresh; + } case GETCHAR_CURSOR_UP: if (selected_entry == 0) selected_entry = max_entries - 1;