Support UTF-8 key bindings by expanding the key type from int to

uint64_t and converting UTF-8 to Unicode on input and the reverse on
output. (This allows key bindings, there are still omissions - the
largest being that the various prompts do not accept UTF-8.)
This commit is contained in:
nicm
2015-11-12 11:05:34 +00:00
parent 7062b0e65d
commit 69e0b8326a
19 changed files with 280 additions and 168 deletions

View File

@ -37,7 +37,11 @@ key_table_cmp(struct key_table *e1, struct key_table *e2)
int
key_bindings_cmp(struct key_binding *bd1, struct key_binding *bd2)
{
return (bd1->key - bd2->key);
if (bd1->key < bd2->key)
return (-1);
if (bd1->key > bd2->key)
return (1);
return (0);
}
struct key_table *
@ -80,7 +84,7 @@ key_bindings_unref_table(struct key_table *table)
}
void
key_bindings_add(const char *name, int key, int can_repeat,
key_bindings_add(const char *name, key_code key, int can_repeat,
struct cmd_list *cmdlist)
{
struct key_table *table;
@ -105,7 +109,7 @@ key_bindings_add(const char *name, int key, int can_repeat,
}
void
key_bindings_remove(const char *name, int key)
key_bindings_remove(const char *name, key_code key)
{
struct key_table *table;
struct key_binding bd_find, *bd;