From 578091f051541ffcd68fb755641fd7c45e28977c Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Wed, 30 Aug 2017 16:27:29 +0200 Subject: Add support for UTF-8 key bindings A new function keys_wgetch() reads full UTF-8 characters instead of single ASCII characters only. Key bindings for regular ASCII characters are stored in a hash map while the actions of keys with higher code points are stored in a linked list for space efficiency. The key serialization methods are updated to handle UTF-8 characters as well; extended UTF-8 characters (characters not in the ASCII range) are serialized by using the hexadecimal representation of the corresponding code points (e.g. "U+00E4"). Signed-off-by: Lukas Fleischer --- src/custom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/custom.c') diff --git a/src/custom.c b/src/custom.c index ce219c1..f83a87a 100644 --- a/src/custom.c +++ b/src/custom.c @@ -972,10 +972,10 @@ void custom_keys_config(void) (col - WINCOL) / 2, _("Press the key you want to assign to:"), keys_get_label(selrow), 0); - ch = wgetch(grabwin); + ch = keys_wgetch(grabwin); /* First check if this key would be recognized by calcurse. */ - if (keys_str2int(keys_int2str(ch)) == -1) { + if (ch < 0) { not_recognized = 1; WARN_MSG(_("This key is not yet recognized by calcurse, " "please choose another one.")); -- cgit v1.2.3-54-g00ecf