From ec861c629691b5ca37fa05473c6ef4121fec7f1d Mon Sep 17 00:00:00 2001 From: Rafal Kupiec Date: Sat, 23 Dec 2023 09:45:11 +0100 Subject: [PATCH] Add ability to jump between first and last menu entry with PageUp/PageDown keys --- xtldr2/textui.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/xtldr2/textui.c b/xtldr2/textui.c index eccfa32..fa2fb93 100644 --- a/xtldr2/textui.c +++ b/xtldr2/textui.c @@ -1100,6 +1100,28 @@ BlDisplayBootMenu() BlpDrawBootMenuEntry(&Handle, MenuEntries[HighligtedEntryId].EntryName, HighligtedEntryId, TRUE); } } + else if(Key.ScanCode == 0x09) + { + /* PageUp key pressed, go to top entry */ + if(HighligtedEntryId != 0) + { + /* Highlight first entry */ + BlpDrawBootMenuEntry(&Handle, MenuEntries[HighligtedEntryId].EntryName, HighligtedEntryId, FALSE); + BlpDrawBootMenuEntry(&Handle, MenuEntries[0].EntryName, 0, TRUE); + HighligtedEntryId = 0; + } + } + else if(Key.ScanCode == 0x0A) + { + /* PageDown key pressed, go to bottom entry */ + if(HighligtedEntryId != NumberOfEntries - 1) + { + /* Highlight last entry */ + BlpDrawBootMenuEntry(&Handle, MenuEntries[HighligtedEntryId].EntryName, HighligtedEntryId, FALSE); + BlpDrawBootMenuEntry(&Handle, MenuEntries[NumberOfEntries - 1].EntryName, NumberOfEntries - 1, TRUE); + HighligtedEntryId = NumberOfEntries - 1; + } + } else if(Key.ScanCode == 0x0B) { /* F1 key pressed, show help */ @@ -1111,6 +1133,7 @@ BlDisplayBootMenu() else if(Key.UnicodeChar == 0x65) { /* 'e' key pressed, edit the highlighted entry */ + BlDisplayErrorDialog(L"XTLDR", L"Editing boot menu entries is not implemented yet!"); /* Break from boot menu event loop to redraw whole boot menu */ break;