some additional key sequences for arc

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-05-13 16:38:23 +02:00
parent 12ce749d86
commit ae6a81f0bb
2 changed files with 53 additions and 8 deletions

View file

@ -445,7 +445,8 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
{'K', GRUB_TERM_KEY_END},
{'P', GRUB_TERM_KEY_DC},
{'?', GRUB_TERM_KEY_PPAGE},
{'/', GRUB_TERM_KEY_NPAGE}
{'/', GRUB_TERM_KEY_NPAGE},
{'@', GRUB_TERM_KEY_INSERT},
};
static struct
@ -460,6 +461,14 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
{'5', GRUB_TERM_KEY_PPAGE},
{'6', GRUB_TERM_KEY_NPAGE}
};
char fx_key[] =
{ 'P', 'Q', 'w', 'x', 't', 'u',
'q', 'r', 'p', 'M', 'A', 'B' };
unsigned fx_code[] =
{ 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 };
unsigned i;
if (c == '\e')
@ -480,6 +489,41 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
return;
}
switch (c)
{
case 'O':
CONTINUE_READ;
for (i = 0; i < ARRAY_SIZE (fx_key); i++)
if (fx_key[i] == c)
{
keys[0] = fx_code[i];
*len = 1;
return;
}
return;
case '0':
{
int num = 0;
CONTINUE_READ;
if (c != '0' && c != '1')
return;
num = (c - '0') * 10;
CONTINUE_READ;
if (c < '0' || c > '9')
return;
num += (c - '0');
if (num == 0 || num > 12)
return;
CONTINUE_READ;
if (c != 'q')
return;
keys[0] = fx_code[num - 1];
*len = 1;
return;
}
default:
for (i = 0; i < ARRAY_SIZE (four_code_table); i++)
if (four_code_table[i].key == c)
{
@ -492,6 +536,7 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
}
return;
}
}
#undef CONTINUE_READ
}

View file

@ -27,7 +27,7 @@ char *EXPORT_FUNC(grub_terminfo_get_current) (struct grub_term_output *term);
grub_err_t EXPORT_FUNC(grub_terminfo_set_current) (struct grub_term_output *term,
const char *);
#define GRUB_TERMINFO_READKEY_MAX_LEN 4
#define GRUB_TERMINFO_READKEY_MAX_LEN 6
struct grub_terminfo_input_state
{
int input_buf[GRUB_TERMINFO_READKEY_MAX_LEN];