From 69e0b8326ad0a983759518b90ed8632146341acf Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 12 Nov 2015 11:05:34 +0000 Subject: 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.) --- key-bindings.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'key-bindings.c') diff --git a/key-bindings.c b/key-bindings.c index 83b94ac1..47a7d867 100644 --- a/key-bindings.c +++ b/key-bindings.c @@ -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; -- cgit v1.2.3