mirror of
https://github.com/limine-bootloader/limine
synced 2024-12-01 04:37:03 +03:00
readline: Fix handling of escape key for BIOS
This commit is contained in:
parent
4c1782357a
commit
eb51e5a14a
@ -33,6 +33,8 @@ int getchar_internal(uint8_t scancode, uint8_t ascii) {
|
||||
return GETCHAR_PGUP;
|
||||
case 0x51:
|
||||
return GETCHAR_PGDOWN;
|
||||
case 0x01:
|
||||
return GETCHAR_ESCAPE;
|
||||
#elif defined (uefi)
|
||||
case SCAN_F10:
|
||||
return GETCHAR_F10;
|
||||
@ -55,7 +57,7 @@ int getchar_internal(uint8_t scancode, uint8_t ascii) {
|
||||
case SCAN_PAGE_DOWN:
|
||||
return GETCHAR_PGDOWN;
|
||||
case SCAN_ESC:
|
||||
return '\e';
|
||||
return GETCHAR_ESCAPE;
|
||||
#endif
|
||||
}
|
||||
switch (ascii) {
|
||||
@ -65,8 +67,9 @@ int getchar_internal(uint8_t scancode, uint8_t ascii) {
|
||||
return '\b';
|
||||
}
|
||||
// Guard against non-printable values
|
||||
if (ascii < 0x20 || ascii > 0x7e)
|
||||
if (ascii < 0x20 || ascii > 0x7e) {
|
||||
return -1;
|
||||
}
|
||||
return ascii;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#define GETCHAR_PGUP (-17)
|
||||
#define GETCHAR_PGDOWN (-18)
|
||||
#define GETCHAR_F10 (-19)
|
||||
#define GETCHAR_ESCAPE (-20)
|
||||
|
||||
int getchar(void);
|
||||
void readline(const char *orig_str, char *buf, size_t limit);
|
||||
|
@ -258,7 +258,7 @@ refresh:
|
||||
case GETCHAR_F10:
|
||||
disable_cursor();
|
||||
return buffer;
|
||||
case '\e':
|
||||
case GETCHAR_ESCAPE:
|
||||
disable_cursor();
|
||||
return NULL;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user