summaryrefslogtreecommitdiffstats
path: root/key-bindings.c
diff options
context:
space:
mode:
authornicm <nicm>2015-11-12 11:05:34 +0000
committernicm <nicm>2015-11-12 11:05:34 +0000
commit69e0b8326ad0a983759518b90ed8632146341acf (patch)
tree03f69cf9a96b5e87b760243cc535878940bc7a02 /key-bindings.c
parent7062b0e65dcbb94bb190f6c50f4089b2ea6278bb (diff)
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.)
Diffstat (limited to 'key-bindings.c')
-rw-r--r--key-bindings.c10
1 files changed, 7 insertions, 3 deletions
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;