core: use GRUB_TERM_ definitions when handling term characters
* Also use hex value for GRUB_TERM_ESC as '\e' is not in the C standard and is not understood by some compilers
This commit is contained in:
parent
5f294d3b9e
commit
5ba09fb415
13 changed files with 25 additions and 24 deletions
|
@ -104,7 +104,7 @@ const unsigned efi_codes[] =
|
|||
GRUB_TERM_KEY_DC, GRUB_TERM_KEY_PPAGE, GRUB_TERM_KEY_NPAGE, GRUB_TERM_KEY_F1,
|
||||
GRUB_TERM_KEY_F2, GRUB_TERM_KEY_F3, GRUB_TERM_KEY_F4, GRUB_TERM_KEY_F5,
|
||||
GRUB_TERM_KEY_F6, GRUB_TERM_KEY_F7, GRUB_TERM_KEY_F8, GRUB_TERM_KEY_F9,
|
||||
GRUB_TERM_KEY_F10, GRUB_TERM_KEY_F11, GRUB_TERM_KEY_F12, '\e'
|
||||
GRUB_TERM_KEY_F10, GRUB_TERM_KEY_F11, GRUB_TERM_KEY_F12, GRUB_TERM_ESC
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
@ -204,7 +204,7 @@ static int
|
|||
grub_console_getkey (struct grub_term_input *term __attribute__ ((unused)))
|
||||
{
|
||||
const grub_uint16_t bypass_table[] = {
|
||||
0x0100 | '\e', 0x0f00 | '\t', 0x0e00 | '\b', 0x1c00 | '\r', 0x1c00 | '\n'
|
||||
0x0100 | GRUB_TERM_ESC, 0x0f00 | GRUB_TERM_TAB, 0x0e00 | GRUB_TERM_BACKSPACE, 0x1c00 | '\r', 0x1c00 | '\n'
|
||||
};
|
||||
struct grub_bios_int_registers regs;
|
||||
unsigned i;
|
||||
|
|
|
@ -426,12 +426,12 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
|
|||
}
|
||||
*len = 1;
|
||||
keys[0] = c;
|
||||
if (c != ANSI_CSI && c != '\e')
|
||||
if (c != ANSI_CSI && c != GRUB_TERM_ESC)
|
||||
{
|
||||
/* Backspace: Ctrl-h. */
|
||||
if (c == 0x7f)
|
||||
c = '\b';
|
||||
if (c < 0x20 && c != '\t' && c!= '\b' && c != '\n' && c != '\r')
|
||||
c = GRUB_TERM_BACKSPACE;
|
||||
if (c < 0x20 && c != GRUB_TERM_TAB && c!= GRUB_TERM_BACKSPACE && c != '\n' && c != '\r')
|
||||
c = GRUB_TERM_CTRL | (c - 1 + 'a');
|
||||
*len = 1;
|
||||
keys[0] = c;
|
||||
|
@ -487,7 +487,7 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
|
|||
GRUB_TERM_KEY_HOME, GRUB_TERM_KEY_END };
|
||||
unsigned i;
|
||||
|
||||
if (c == '\e')
|
||||
if (c == GRUB_TERM_ESC)
|
||||
{
|
||||
CONTINUE_READ;
|
||||
|
||||
|
@ -606,7 +606,7 @@ grub_terminfo_getkey (struct grub_term_input *termi)
|
|||
&data->npending, data->readkey);
|
||||
|
||||
#if defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275)
|
||||
if (data->npending == 1 && data->input_buf[0] == '\e'
|
||||
if (data->npending == 1 && data->input_buf[0] == GRUB_TERM_ESC
|
||||
&& grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_REPEAT)
|
||||
&& grub_get_time_ms () - data->last_key_time < 1000
|
||||
&& (data->last_key & GRUB_TERM_EXTENDED))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue