From 3b68a774b9e2b1c80fe0a962fc8a4b32e9b0a2e2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 19 Feb 2012 16:51:11 +0100 Subject: [PATCH] input: fix "enter" on console The commit "input: handle UTF-8 terminal input" accidentally messed up the handling of certain special keys. Apparently only KEY_ENTER was affected by this, because the code was valid UTF-8, but didn't directly map to the keycode. --- osdep/getch2.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/osdep/getch2.c b/osdep/getch2.c index 1eb78070c0..1a92866afd 100644 --- a/osdep/getch2.c +++ b/osdep/getch2.c @@ -202,14 +202,15 @@ void getch2(struct mp_fifo *fifo) len = 2; } code = KEY_ENTER; - } - int utf8len = bstr_parse_utf8_code_length(code); - if (utf8len > 0 && utf8len <= getch2_len) { - struct bstr s = { getch2_buf, utf8len }; - int unicode = bstr_decode_utf8(s, NULL); - if (unicode > 0) { - len = utf8len; - code = unicode; + } else { + int utf8len = bstr_parse_utf8_code_length(code); + if (utf8len > 0 && utf8len <= getch2_len) { + struct bstr s = { getch2_buf, utf8len }; + int unicode = bstr_decode_utf8(s, NULL); + if (unicode > 0) { + len = utf8len; + code = unicode; + } } } }