From 36bc6cd0952b2eddc17e7da803d85decf96d32cc Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Sun, 28 Sep 2014 03:51:45 +0200
Subject: Move to iconv
That is the major change in this commit.
Also Ctrl-modified keys now should work in URxvt,
which was surprisingly trivial to achieve.
Coming up next:
- making sure the tests still work
- introducing CMake
---
t/02getkey.c | 8 ++++----
t/03utf8.c | 30 +++++++++++++++---------------
2 files changed, 19 insertions(+), 19 deletions(-)
(limited to 't')
diff --git a/t/02getkey.c b/t/02getkey.c
index 279a598..d85f29b 100644
--- a/t/02getkey.c
+++ b/t/02getkey.c
@@ -20,10 +20,10 @@ int main(int argc, char *argv[])
is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY after h");
- is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type after h");
- is_int(key.code.codepoint, 'h', "key.code.codepoint after h");
- is_int(key.modifiers, 0, "key.modifiers after h");
- is_str(key.utf8, "h", "key.utf8 after h");
+ is_int(key.type, TERMKEY_TYPE_KEY, "key.type after h");
+ is_int(key.code.codepoint, 'h', "key.code.codepoint after h");
+ is_int(key.modifiers, 0, "key.modifiers after h");
+ is_str(key.multibyte, "h", "key.multibyte after h");
is_int(termkey_get_buffer_remaining(tk), 256, "buffer free 256 after getkey");
diff --git a/t/03utf8.c b/t/03utf8.c
index 53f228b..5aead24 100644
--- a/t/03utf8.c
+++ b/t/03utf8.c
@@ -8,13 +8,13 @@ int main(int argc, char *argv[])
plan_tests(57);
- tk = termkey_new_abstract("vt100", TERMKEY_FLAG_UTF8);
+ tk = termkey_new_abstract("vt100", "UTF-8", 0);
termkey_push_bytes(tk, "a", 1);
is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY low ASCII");
- is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type low ASCII");
- is_int(key.code.codepoint, 'a', "key.code.codepoint low ASCII");
+ is_int(key.type, TERMKEY_TYPE_KEY, "key.type low ASCII");
+ is_int(key.code.codepoint, 'a', "key.code.codepoint low ASCII");
/* 2-byte UTF-8 range is U+0080 to U+07FF (0xDF 0xBF) */
/* However, we'd best avoid the C1 range, so we'll start at U+00A0 (0xC2 0xA0) */
@@ -22,42 +22,42 @@ int main(int argc, char *argv[])
termkey_push_bytes(tk, "\xC2\xA0", 2);
is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 2 low");
- is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 2 low");
- is_int(key.code.codepoint, 0x00A0, "key.code.codepoint UTF-8 2 low");
+ is_int(key.type, TERMKEY_TYPE_KEY, "key.type UTF-8 2 low");
+ is_int(key.code.codepoint, 0x00A0, "key.code.codepoint UTF-8 2 low");
termkey_push_bytes(tk, "\xDF\xBF", 2);
is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 2 high");
- is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 2 high");
- is_int(key.code.codepoint, 0x07FF, "key.code.codepoint UTF-8 2 high");
+ is_int(key.type, TERMKEY_TYPE_KEY, "key.type UTF-8 2 high");
+ is_int(key.code.codepoint, 0x07FF, "key.code.codepoint UTF-8 2 high");
/* 3-byte UTF-8 range is U+0800 (0xE0 0xA0 0x80) to U+FFFD (0xEF 0xBF 0xBD) */
termkey_push_bytes(tk, "\xE0\xA0\x80", 3);
is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 3 low");
- is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 3 low");
- is_int(key.code.codepoint, 0x0800, "key.code.codepoint UTF-8 3 low");
+ is_int(key.type, TERMKEY_TYPE_KEY, "key.type UTF-8 3 low");
+ is_int(key.code.codepoint, 0x0800, "key.code.codepoint UTF-8 3 low");
termkey_push_bytes(tk, "\xEF\xBF\xBD", 3);
is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 3 high");
- is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 3 high");
- is_int(key.code.codepoint, 0xFFFD, "key.code.codepoint UTF-8 3 high");
+ is_int(key.type, TERMKEY_TYPE_KEY, "key.type UTF-8 3 high");
+ is_int(key.code.codepoint, 0xFFFD, "key.code.codepoint UTF-8 3 high");
/* 4-byte UTF-8 range is U+10000 (0xF0 0x90 0x80 0x80) to U+10FFFF (0xF4 0x8F 0xBF 0xBF) */
termkey_push_bytes(tk, "\xF0\x90\x80\x80", 4);
is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 4 low");
- is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 4 low");
- is_int(key.code.codepoint, 0x10000, "key.code.codepoint UTF-8 4 low");
+ is_int(key.type, TERMKEY_TYPE_KEY, "key.type UTF-8 4 low");
+ is_int(key.code.codepoint, 0x10000, "key.code.codepoint UTF-8 4 low");
termkey_push_bytes(tk, "\xF4\x8F\xBF\xBF", 4);
is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY UTF-8 4 high");
- is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type UTF-8 4 high");
- is_int(key.code.codepoint, 0x10FFFF, "key.code.codepoint UTF-8 4 high");
+ is_int(key.type, TERMKEY_TYPE_KEY, "key.type UTF-8 4 high");
+ is_int(key.code.codepoint, 0x10FFFF, "key.code.codepoint UTF-8 4 high");
/* Invalid continuations */
--
cgit v1.2.3-70-g09d2