aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2008-02-10 18:12:19 +0000
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2008-02-10 18:12:19 +0000
commit516a1766a59b4abec389e8ed4eadf666701f356e (patch)
tree2009ebad7861e66c210fa8e6e0c6b61248efaf17
parent98840316257bc66a35a6c1db27697763fbf73a46 (diff)
downloadtermo-516a1766a59b4abec389e8ed4eadf666701f356e.tar.gz
termo-516a1766a59b4abec389e8ed4eadf666701f356e.tar.xz
termo-516a1766a59b4abec389e8ed4eadf666701f356e.zip
Bugfix to fill_utf8() to make it actually work right
-rw-r--r--termkey.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/termkey.c b/termkey.c
index f0f9d1a..3a80896 100644
--- a/termkey.c
+++ b/termkey.c
@@ -301,8 +301,9 @@ static void fill_utf8(termkey_key *key)
// This is easier done backwards
int b = nbytes;
- while(b-- > 0) {
- key->utf8[b] = codepoint & 0x3f;
+ while(b > 1) {
+ b--;
+ key->utf8[b] = 0x80 | (codepoint & 0x3f);
codepoint >>= 6;
}