diff options
author | wm4 <wm4@mplayer2.org> | 2012-02-19 16:51:11 +0100 |
---|---|---|
committer | wm4 <wm4@mplayer2.org> | 2012-02-19 16:51:52 +0100 |
commit | 3b68a774b9e2b1c80fe0a962fc8a4b32e9b0a2e2 (patch) | |
tree | 3e07a29eb21c4ae6f9c84c2bb792d0c8e6c329aa /osdep | |
parent | 7822eca9ace01ff933d35382c345d322bdf2eb57 (diff) | |
download | mpv-3b68a774b9e2b1c80fe0a962fc8a4b32e9b0a2e2.tar.bz2 mpv-3b68a774b9e2b1c80fe0a962fc8a4b32e9b0a2e2.tar.xz |
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.
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/getch2.c | 17 |
1 files 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; + } } } } |